Merge pull request #240 from jackboot7/master
Added a new param to the Twython __init__ that lets you select the authe...
This commit is contained in:
commit
3f69928bf6
1 changed files with 5 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ warnings.simplefilter('always', TwythonDeprecationWarning) # For Python 2.7 >
|
|||
class Twython(EndpointsMixin, object):
|
||||
def __init__(self, app_key=None, app_secret=None, oauth_token=None,
|
||||
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).
|
||||
|
||||
: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.
|
||||
See http://docs.python-requests.org/en/latest/api/#sessionapi and requests section below it for details.
|
||||
[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
|
||||
self.request_token_url = self.api_url % 'oauth/request_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
|
||||
oauth_version = 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue