Commit f334323e authored by Aaron Hill's avatar Aaron Hill
Browse files

Add proxy support

parent f24342c5
......@@ -19,7 +19,7 @@ class API(object):
cache=None, api_root='/1.1', search_root='',
retry_count=0, retry_delay=0, retry_errors=None, timeout=60,
parser=None, compression=False, wait_on_rate_limit=False,
wait_on_rate_limit_notify=False):
wait_on_rate_limit_notify=False, proxy=None):
self.auth = auth_handler
self.host = host
self.search_host = search_host
......@@ -34,6 +34,9 @@ class API(object):
self.wait_on_rate_limit = wait_on_rate_limit
self.wait_on_rate_limit_notify = wait_on_rate_limit_notify
self.parser = parser or ModelParser()
self.proxy = {}
if proxy:
self.proxy['https'] = proxy
""" statuses/home_timeline """
home_timeline = bind_api(
......
......@@ -154,7 +154,7 @@ def bind_api(**config):
try:
resp = self.session.request(self.method, full_url,
data=self.post_data, timeout=self.api.timeout,
auth=auth)
auth=auth, proxies=self.api.proxy)
except Exception, e:
raise TweepError('Failed to send request: %s' % e)
rem_calls = resp.headers.get('x-rate-limit-remaining')
......
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