mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Catch socket.gaierror in safe mode.
This commit is contained in:
@@ -28,7 +28,8 @@ def catch_exceptions_if_in_safe_mode(function):
|
||||
and kwargs.get('session').config.get('safe_mode')):
|
||||
try:
|
||||
return function(method, url, **kwargs)
|
||||
except (RequestException, ConnectionError, HTTPError, socket.timeout) as e:
|
||||
except (RequestException, ConnectionError, HTTPError,
|
||||
socket.timeout, socket.gaierror) as e:
|
||||
r = Response()
|
||||
r.error = e
|
||||
r.raw = HTTPResponse() # otherwise, tests fail
|
||||
|
||||
Reference in New Issue
Block a user