diff --git a/twython/twython.py b/twython/twython.py index 7232c20..91e9942 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -100,7 +100,7 @@ class AuthError(TwythonError): class Twython(object): - def __init__(self, twitter_token = None, twitter_secret = None, oauth_token = None, oauth_token_secret = None, headers=None, callback_url=None): + def __init__(self, twitter_token = None, twitter_secret = None, oauth_token = None, oauth_token_secret = None, headers=None, callback_url=None, client_args={}): """setup(self, oauth_token = None, headers = None) Instantiates an instance of Twython. Takes optional parameters for authentication and such (see below). @@ -112,6 +112,7 @@ class Twython(object): pass it in and it'll be used for all requests going forward. oauth_token_secret - see oauth_token; it's the other half. headers - User agent header, dictionary style ala {'User-Agent': 'Bert'} + client_args - additional arguments for HTTP client (see httplib2.Http.__init__), e.g. {'timeout': 10.0} ** Note: versioning is not currently used by search.twitter functions; when Twitter moves their junk, it'll be supported. """ @@ -142,12 +143,12 @@ class Twython(object): # Filter down through the possibilities here - if they have a token, if they're first stage, etc. if consumer is not None and token is not None: - self.client = oauth.Client(consumer, token) + self.client = oauth.Client(consumer, token, **client_args) elif consumer is not None: - self.client = oauth.Client(consumer) + self.client = oauth.Client(consumer, **client_args) else: # If they don't do authentication, but still want to request unprotected resources, we need an opener. - self.client = httplib2.Http() + self.client = httplib2.Http(**client_args) def __getattr__(self, api_call): """