Catch socket.gaierror in safe mode.
authorCory Benfield <lukasaoz@gmail.com>
Thu, 2 Aug 2012 11:16:41 +0000 (12:16 +0100)
committerCory Benfield <lukasaoz@gmail.com>
Thu, 2 Aug 2012 11:16:41 +0000 (12:16 +0100)
requests/safe_mode.py

index 619d368c7fa9ac79889b1e4a278f8c986f8c6a26..cd171f7d6441f6a076cb23336e8be1aaf23dba42 100644 (file)
@@ -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