From: Cory Benfield Date: Thu, 2 Aug 2012 11:16:41 +0000 (+0100) Subject: Catch socket.gaierror in safe mode. X-Git-Tag: v0.13.6~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f40b3befc2bb830ae48a2637e3af99fc5bbc768;p=services%2Fpython-requests.git Catch socket.gaierror in safe mode. --- diff --git a/requests/safe_mode.py b/requests/safe_mode.py index 619d368..cd171f7 100644 --- a/requests/safe_mode.py +++ b/requests/safe_mode.py @@ -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