How to access the Twitter API after login with Django social auth?

django, django-socialauth, twitter

Solution

This example from the Django-social-auth docs shows what you need:

>>> from pprint import pprint
>>> from social_auth.models import UserSocialAuth
>>> instance = UserSocialAuth.objects.filter(provider='twitter').get(...)
>>> pprint(instance.tokens)
{u'oauth_token': u'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
 u'_token_secret': u'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'}

The UserSocialAuth model will automatically store the access tokens you need. You access them via the `tokens` attribute.

Hope that helps.

Problem

I would like to play with the twitter API, but I'm lost with how access the API, get TimeLine, RT, etc, after login with django social auth. Can anyone provide an example of another twitter library that I can use to access streaming, timeline, etc. after authenticating with Django social Auth? I'm checking tweepy but I can't see how to use it if I don't need to use the tweepy auth method.

Original source