Commit 6385c3bf authored by Aaron Hill's avatar Aaron Hill Committed by GitHub
Browse files

Merge pull request #799 from vatsalparekh/master

Update in the Documentation about 'oauth_token' 
parents d21fbbe5 368cee2a
...@@ -47,7 +47,7 @@ using the API. We must complete the following steps: ...@@ -47,7 +47,7 @@ using the API. We must complete the following steps:
us. Otherwise the user must manually supply us with the verifier us. Otherwise the user must manually supply us with the verifier
code. 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:: So let's fetch our request token to begin the dance::
...@@ -80,7 +80,7 @@ twitter as a GET query parameter in the URL. ...@@ -80,7 +80,7 @@ twitter as a GET query parameter in the URL.
# Example using callback (web app) # Example using callback (web app)
verifier = request.GET.get('oauth_verifier') verifier = request.GET.get('oauth_verifier')
# Example w/o callback (desktop) # Example w/o callback (desktop)
verifier = raw_input('Verifier:') verifier = raw_input('Verifier:')
...@@ -93,13 +93,14 @@ treasure box. To fetch this token we do the following:: ...@@ -93,13 +93,14 @@ treasure box. To fetch this token we do the following::
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
token = session.get('request_token') token = session.get('request_token')
session.delete('request_token') session.delete('request_token')
auth.request_token = token auth.request_token = { 'oauth_token' : token,
'oauth_token_secret' : verifier }
try: try:
auth.get_access_token(verifier) auth.get_access_token(verifier)
except tweepy.TweepError: except tweepy.TweepError:
print 'Error! Failed to get access token.' print 'Error! Failed to get access token.'
It is a good idea to save the access token for later use. You do not 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 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 tokens, so the only time it would ever go invalid is if the user
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment