us. Otherwise the user must manually supply us with the verifier
code.
-#. Exchange the authorized request token for an access token.
+#. Exchange the authorized request token for an access token.
So let's fetch our request token to begin the dance::
# Example using callback (web app)
verifier = request.GET.get('oauth_verifier')
-
+
# Example w/o callback (desktop)
verifier = raw_input('Verifier:')
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
token = session.get('request_token')
session.delete('request_token')
- auth.request_token = token
-
+ auth.request_token = { 'oauth_token' : token,
+ 'oauth_token_secret' : verifier }
+
try:
auth.get_access_token(verifier)
except tweepy.TweepError:
print 'Error! Failed to get access token.'
-
+
It is a good idea to save the access token for later use. You do not
need to re-fetch it each time. Twitter currently does not expire the
tokens, so the only time it would ever go invalid is if the user