Skip to content

Instantly share code, notes, and snippets.

@vinigracindo
Created March 14, 2012 23:41
Show Gist options
  • Save vinigracindo/2040434 to your computer and use it in GitHub Desktop.
Save vinigracindo/2040434 to your computer and use it in GitHub Desktop.
import settings
import tweepy
From user_auth.models import UserSocialAuth
From django.contrib.auth.models import User
user = User.objects.get(id=10) # Suponha que existe um usuário 10 com facebook
oauth = tweepy.OAuthHandler(settings.TWITTER_CONSUMER_KEY, settings.TWITTER_CONSUMER_SECRET)
access_token = UserSocialAuth.objects.get(user = user, provider = 'twitter').extra_data['access_token']
oauth.set_access_token(access_token ['oauth_token'][0], access_token ['oauth_token_secret'][0])
user._twitter = tweepy.API(oauth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment