mardi 14 juin 2016

How do I display object I get from public_tweets = api.home_timeline() in My Django app?

EDIT I'm new to this so excuse me for not knowing much, I Just started messing with tweepy in my django app. I want to pull in objects from

public_tweets = api.home_timeline()

and display them in my django template. I tried doing this

    CONSUMER_KEY = 'jk'
CONSUMER_SECRET = 'op'
OAUTH_TOKEN = 'o-'
OAUTH_TOKEN_SECRET = 'jo'


auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET)

api = tweepy.API(auth)
user = api.get_user('raso0')

public_tweets = api.home_timeline()

context = {
    "tweets": public_tweets
    }

and In my templateI did

{{tweets}}

and also

 {% for t in tweets %}
  {{t}}
 {% endfor %}

neither of those worked though. My ultimate goal is to pull the the top hashtags in twitter and the users connected to them. But primarily to get the top hash tags the users are secondary any help on how to make this work would be great.

Aucun commentaire:

Enregistrer un commentaire