Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

30 lines (20 sloc) 751 Bytes
import webbrowser
import tweepy
"""
Query the user for their consumer key/secret
then attempt to fetch a valid access token.
"""
if __name__ == "__main__":
consumer_key = raw_input('Consumer key: ').strip()
consumer_secret = raw_input('Consumer secret: ').strip()
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# Open authorization URL in browser
webbrowser.open(auth.get_authorization_url())
# Ask user for verifier pin
pin = raw_input('Verification pin number from twitter.com: ').strip()
# Get access token
token = auth.get_access_token(verifier=pin)
# Give user the access token
print 'Access token:'
print ' Key: %s' % token.key
print ' Secret: %s' % token.secret
You can’t perform that action at this time.