kennethreitz/requests — Issue #289: original errors get swallowed due to retries
Author: cactus
Created: 2011-11-26 11:28:28+00:00
State: open

specifically, hostname nonexistence is being swallowed in my case, but because a retry is always attempted if a conn is None in urlib3 (it appears), then after invocation the retry is aborted if tries is too large, then a max connection exception is thrown (losing the original exception)

~~~ .python
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> import requests
>>> r = requests.get('http://doesntexist.foo')
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): doesntexist.foo
WARNING:requests.packages.urllib3.connectionpool:Retrying (0 attempts remain) after connection broken by 'gaierror(8, 'nodename nor servname provided, or not known')': /
Traceback (most recent call last):
File "", line 1, in
File "venv/lib/python2.6/site-packages/requests/api.py", line 78, in get
return request('get', url, **kwargs)
File "venv/lib/python2.6/site-packages/requests/api.py", line 65, in request
prefetch=prefetch
File "venv/lib/python2.6/site-packages/requests/sessions.py", line 191, in request
r.send(prefetch=prefetch)
File "venv/lib/python2.6/site-packages/requests/models.py", line 453, in send
raise ConnectionError(e)
requests.exceptions.ConnectionError: Max retries exceeded for url: /
>>>
~~~