This commit is contained in:
Luis Alberto Santana 2013-07-23 08:53:21 -07:00
commit 6f08fd217b

View file

@ -28,7 +28,7 @@ warnings.simplefilter('always', TwythonDeprecationWarning) # For Python 2.7 >
class Twython(EndpointsMixin, object): class Twython(EndpointsMixin, object):
def __init__(self, app_key=None, app_secret=None, oauth_token=None, def __init__(self, app_key=None, app_secret=None, oauth_token=None,
oauth_token_secret=None, access_token=None, token_type='bearer', oauth_token_secret=None, access_token=None, token_type='bearer',
oauth_version=1, api_version='1.1', client_args=None): oauth_version=1, api_version='1.1', client_args=None, auth_endpoint='authenticate'):
"""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).
:param app_key: (optional) Your applications key :param app_key: (optional) Your applications key
@ -43,6 +43,9 @@ class Twython(EndpointsMixin, object):
:param client_args: (optional) Accepts some requests Session parameters and some requests Request parameters. :param client_args: (optional) Accepts some requests Session parameters and some requests Request parameters.
See http://docs.python-requests.org/en/latest/api/#sessionapi and requests section below it for details. See http://docs.python-requests.org/en/latest/api/#sessionapi and requests section below it for details.
[ex. headers, proxies, verify(SSL verification)] [ex. headers, proxies, verify(SSL verification)]
:param auth_endpoint: (optional) Lets you select which authentication endpoint will use your application.
This will allow the application to have DM access if the endpoint is 'authorize'.
Default: authenticate.
""" """
@ -59,7 +62,7 @@ class Twython(EndpointsMixin, object):
# OAuth 1 # OAuth 1
self.request_token_url = self.api_url % 'oauth/request_token' self.request_token_url = self.api_url % 'oauth/request_token'
self.access_token_url = self.api_url % 'oauth/access_token' self.access_token_url = self.api_url % 'oauth/access_token'
self.authenticate_url = self.api_url % 'oauth/authenticate' self.authenticate_url = self.api_url % ('oauth/%s' % auth_endpoint)
if self.access_token: # If they pass an access token, force OAuth 2 if self.access_token: # If they pass an access token, force OAuth 2
oauth_version = 2 oauth_version = 2