I am Trying to return results from twitter in my django app but I get nothing. I'm following tutorial example. Today is the first day I've tried to use twitter and django. this is my code in my view
import twitter
CONSUMER_KEY = 'CONSUMER_KEY'
CONSUMER_SECRET = 'CONSUMER_SECRET'
OAUTH_TOKEN = 'OAUTH_TOKEN'
OAUTH_TOKEN_SECRET = 'OAUTH_TOKEN_SECRET'
auth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUTH_TOKEN_SECRET,
CONSUMER_KEY, CONSUMER_SECRET)
twitter_api = twitter.Twitter(auth=auth)
WORLD_WOE_ID = 1
US_WOE_ID = 23424977
world_trends = twitter_api.trends.place(_id=WORLD_WOE_ID)
us_trends = twitter_api.trends.place(_id=US_WOE_ID)
context = {
"api": world_trends
}
this is in my template in html {{api}}
I also tried
{% for a in api %}
{{a}}
{% endfor %}
and still nothing. Is their something wrong with my syntax?
Just to be clear is the following correct?
CONSUMER_KEY = ' Consumer Key (API Key)'
CONSUMER_SECRET = 'Consumer Secret (API Secret)'
OAUTH_TOKEN = 'Access Token'
OAUTH_TOKEN_SECRET = ' Access Token Secret'
thanks
Aucun commentaire:
Enregistrer un commentaire