When adding an adapter with a retry object to a session, read timeout errors are converted to connection errors.
>>> s = requests.Session()
>>> s.get("http://whatever.com", timeout=(3.05, 0.001))
Timeout: HTTPConnectionPool(host='whatever.com', port=80): Read timed out. (read timeout=0.001)
>>> a = HTTPAdapter(max_retries=Retry(total=3))
>>> s.mount("http://", a)
>>> s.get("http://whatever.com", timeout=(3.05, 0.001))
ConnectionError: HTTPConnectionPool(host='whatever.com', port=80): Max retries exceeded with url: / (Caused by ReadTimeoutError("HTTPConnectionPool(host='whatever.com', port=80): Read timed out. (read timeout=0.001)"))
Is this intentional? If so, what's the reasoning behind it? I'd like to catch these errors, but handle connection errors differently (e.g. warn the user to check his internet connection) from timeout errors (e.g. inform the user that the requested resource is possibly overloaded). Wouldn't it make more sense to raise the original error type once the max number of retries is exceeded?
When adding an adapter with a retry object to a session, read timeout errors are converted to connection errors.
Is this intentional? If so, what's the reasoning behind it? I'd like to catch these errors, but handle connection errors differently (e.g. warn the user to check his internet connection) from timeout errors (e.g. inform the user that the requested resource is possibly overloaded). Wouldn't it make more sense to raise the original error type once the max number of retries is exceeded?