Skip to content
Myr

Catch socket.gaierror in safe mode.

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

authored by Cory Benfield · committed by Cory Benfield · parent 55237ad · Browse files · 1 file+2 added−1 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+2 added−1 removed

  • other:+2 added−1 removed

1 file+2 added−1 removed

modified:requests/safe_mode.py+2 added-1 removed
26 unmodified lines
27 if (kwargs.get('config') and kwargs.get('config').get('safe_mode')) or (kwargs.get('session') 28 and kwargs.get('session').config.get('safe_mode')):29 try:30 return function(method, url, **kwargs)31 except (RequestException, ConnectionError, HTTPError, socket.timeout) as e:31 except (RequestException, ConnectionError, HTTPError,32 socket.timeout, socket.gaierror) as e:33 r = Response()34 r.error = e35 r.raw = HTTPResponse() # otherwise, tests fail36 r.status_code = 0 # with this status_code, content returns None
3 unmodified lines