Catch raw socket errors
authorKenneth Reitz <me@kennethreitz.com>
Fri, 14 Oct 2011 00:47:58 +0000 (20:47 -0400)
committerKenneth Reitz <me@kennethreitz.com>
Fri, 14 Oct 2011 00:47:58 +0000 (20:47 -0400)
requests/models.py

index b3a60c2..8d044d5 100644 (file)
@@ -361,6 +361,8 @@ class Request(object):
                 if hasattr(why, 'reason'):
                     if isinstance(why.reason, socket.timeout):
                         why = Timeout(why)
+                    elif isinstance(why.reason, socket.error):
+                        why = Timeout(why)
 
                 self._build_response(why, is_error=True)