Skip to content

Commit a6008ec

Browse files
committed
Merge pull request tweepy#285.
- Fix code style issue.
2 parents 40842e8 + 24ea422 commit a6008ec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tweepy/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class API(object):
1717
def __init__(self, auth_handler=None,
1818
host='api.twitter.com', search_host='search.twitter.com',
1919
cache=None, secure=True, api_root='/1.1', search_root='',
20-
retry_count=0, retry_delay=0, retry_errors=None,
20+
retry_count=0, retry_delay=0, retry_errors=None, timeout=60,
2121
parser=None):
2222
self.auth = auth_handler
2323
self.host = host
@@ -29,6 +29,7 @@ def __init__(self, auth_handler=None,
2929
self.retry_count = retry_count
3030
self.retry_delay = retry_delay
3131
self.retry_errors = retry_errors
32+
self.timeout = timeout
3233
self.parser = parser or ModelParser()
3334

3435
""" statuses/home_timeline """

tweepy/binder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ def execute(self):
128128
retries_performed = 0
129129
while retries_performed < self.retry_count + 1:
130130
# Open connection
131-
# FIXME: add timeout
132131
if self.api.secure:
133-
conn = httplib.HTTPSConnection(self.host)
132+
conn = httplib.HTTPSConnection(self.host, timeout=self.api.timeout)
134133
else:
135-
conn = httplib.HTTPConnection(self.host)
134+
conn = httplib.HTTPConnection(self.host, timeout=self.api.timeout)
136135

137136
# Apply authentication
138137
if self.api.auth:

0 commit comments

Comments
 (0)