Skip to content

Commit

Permalink
Merge pull request psf#2812 from Lukasa/issue/2811
Browse files Browse the repository at this point in the history
Don't treat NewConnectionErrors as timeouts.
  • Loading branch information
sigmavirus24 committed Oct 8, 2015
2 parents e499b35 + f7be4e5 commit 2da8a60
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion requests/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .packages.urllib3.exceptions import ConnectTimeoutError
from .packages.urllib3.exceptions import HTTPError as _HTTPError
from .packages.urllib3.exceptions import MaxRetryError
from .packages.urllib3.exceptions import NewConnectionError
from .packages.urllib3.exceptions import ProxyError as _ProxyError
from .packages.urllib3.exceptions import ProtocolError
from .packages.urllib3.exceptions import ReadTimeoutError
Expand Down Expand Up @@ -412,7 +413,9 @@ def send(self, request, stream=False, timeout=None, verify=True, cert=None, prox

except MaxRetryError as e:
if isinstance(e.reason, ConnectTimeoutError):
raise ConnectTimeout(e, request=request)
# TODO: Remove this in 3.0.0: see #2811
if not isinstance(e.reason, NewConnectionError):
raise ConnectTimeout(e, request=request)

if isinstance(e.reason, ResponseError):
raise RetryError(e, request=request)
Expand Down

0 comments on commit 2da8a60

Please sign in to comment.