Skip to content
Myr

Differentiate between two types of timeout errors from urllib3

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Bubble up error message from urllib3 to indicate to user whether error was a socket timeout vs a no connections available in connection pool error. Co-Authored By: Sarah Gonzalez

authored by Leila Muhtasib · committed by Leila Muhtasib · parent c3ab38e · Browse files · 1 file+3 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−0 removed

  • other:+3 added−0 removed

1 file+3 added−0 removed

modified:requests/models.py+3 added
15 unmodified lines
1617from .auth import HTTPBasicAuth, HTTPProxyAuth18from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header19from .packages.urllib3.exceptions import MaxRetryError, LocationParseError20from .packages.urllib3.exceptions import TimeoutError21from .packages.urllib3.exceptions import SSLError as _SSLError22from .packages.urllib3.exceptions import HTTPError as _HTTPError23from .packages.urllib3 import connectionpool, poolmanager24from .packages.urllib3.filepost import encode_multipart_formdata
577 unmodified lines
602603 except (_SSLError, _HTTPError) as e:604 if isinstance(e, _SSLError):605 raise SSLError(e)606 elif isinstance(e, TimeoutError):607 raise Timeout(e)608 else:609 raise Timeout('Request timed out.')610611 # build_response can throw TooManyRedirects
225 unmodified lines