moved oauth_verifier from init to method
This commit is contained in:
parent
26b3a232d0
commit
1eb1bd080d
1 changed files with 3 additions and 4 deletions
|
|
@ -81,7 +81,7 @@ class TwythonRateLimitError(TwythonError):
|
||||||
|
|
||||||
|
|
||||||
class Twython(object):
|
class Twython(object):
|
||||||
def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, oauth_verifier=None, \
|
def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, \
|
||||||
headers=None, callback_url=None, twitter_token=None, twitter_secret=None, proxies=None, version='1.1'):
|
headers=None, callback_url=None, twitter_token=None, twitter_secret=None, proxies=None, version='1.1'):
|
||||||
"""Instantiates an instance of Twython. Takes optional parameters for authentication and such (see below).
|
"""Instantiates an instance of Twython. Takes optional parameters for authentication and such (see below).
|
||||||
|
|
||||||
|
|
@ -109,7 +109,6 @@ class Twython(object):
|
||||||
self.oauth_token_secret = oauth_token_secret and u'%s' % oauth_token_secret
|
self.oauth_token_secret = oauth_token_secret and u'%s' % oauth_token_secret
|
||||||
|
|
||||||
self.callback_url = callback_url
|
self.callback_url = callback_url
|
||||||
self.oauth_verifier = oauth_verifier
|
|
||||||
|
|
||||||
# If there's headers, set them, otherwise be an embarassing parent for their own good.
|
# If there's headers, set them, otherwise be an embarassing parent for their own good.
|
||||||
self.headers = headers or {'User-Agent': 'Twython v' + __version__}
|
self.headers = headers or {'User-Agent': 'Twython v' + __version__}
|
||||||
|
|
@ -304,10 +303,10 @@ class Twython(object):
|
||||||
|
|
||||||
return request_tokens
|
return request_tokens
|
||||||
|
|
||||||
def get_authorized_tokens(self):
|
def get_authorized_tokens(self, oauth_verifier):
|
||||||
"""Returns authorized tokens after they go through the auth_url phase.
|
"""Returns authorized tokens after they go through the auth_url phase.
|
||||||
"""
|
"""
|
||||||
response = self.client.get(self.access_token_url,params={'oauth_verifier' : self.oauth_verifier})
|
response = self.client.get(self.access_token_url, params={'oauth_verifier' : oauth_verifier})
|
||||||
authorized_tokens = dict(parse_qsl(response.content))
|
authorized_tokens = dict(parse_qsl(response.content))
|
||||||
if not authorized_tokens:
|
if not authorized_tokens:
|
||||||
raise TwythonError('Unable to decode authorized tokens.')
|
raise TwythonError('Unable to decode authorized tokens.')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue