I've been reading through http://www.mobify.com/blog/http-requests-are-hard/ and http://docs.python-requests.org/en/latest/api/#requests.request to understand timeouts better. based on this I can see that there are connect timeouts:
connect_timeout = 0.0001
try:
response = requests.get(url="https://httpbin.org/delay/5",
timeout=(connect_timeout, 10.0))
except requests.exceptions.ConnectTimeout as e:
print "Too slow Mojo!"
and read timeouts:
read_timeout = 1.0
try:
response = requests.get(url="https://httpbin.org/delay/5",
timeout=(10.0, read_timeout))
except requests.exceptions.ReadTimeout as e:
print "Waited too long between bytes."
I'm also interested in having the requests module "give up" if the response is not completed within a specific time. I'm not sure what the term for this kind of timeout is. How would i make this happen?