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 b3a60c2653a8437698ff832e34c1facd4915d8d6..8d044d516dfb4e51d6526c7f0cb8edca625fb069 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)