-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Labels
Description
Sample code:
def gen():
for i in xrange(1, 1000):
yield 'x'
import requests, datetime
print datetime.datetime.now()
try: requests.post(url='http://1.1.1.1', timeout=5, data=gen())
except Exception as e: print e
print datetime.datetime.now()
try: requests.post(url='http://1.1.1.1', timeout=5, data='a')
except Exception as e: print e
print datetime.datetime.now()
gives the following output
2013-06-14 00:33:03.079389
[Errno 110] Connection timed out
2013-06-14 00:34:06.236742
HTTPConnectionPool(host='1.1.1.1', port=80): Request timed out. (timeout=5)
2013-06-14 00:34:11.242869
The first request blocked for more than a minute, before a timeout has been thrown, while the second one is ok.
Requests 1.2.3
Python 2.7.3
Reactions are currently unavailable