Minor Patch TypeError thrown
authorJosh Brown <josh@epidev.com>
Mon, 23 Mar 2015 05:01:48 +0000 (16:01 +1100)
committerJosh Brown <josh@epidev.com>
Mon, 23 Mar 2015 05:01:48 +0000 (16:01 +1100)
AUTHORS.rst
requests/packages/urllib3/connectionpool.py

index 8a40bd970dfa82d0b065792b200dbdb071fc3b04..10f48cb5bf2bf30bd4a03e8445cb730a2bb2c70e 100644 (file)
@@ -160,4 +160,5 @@ Patches and Suggestions
 - Scott Sadler (`@ssadler <https://github.com/ssadler>`_)
 - Arthur Darcet (`@arthurdarcet <https://github.com/arthurdarcet>`_)
 - Ulrich Petri (`@ulope <https://github.com/ulope>`_)
-- Muhammad Yasoob Ullah Khalid <yasoob.khld@gmail.com> (`@yasoob <https://github.com/yasoob>`_)
\ No newline at end of file
+- Muhammad Yasoob Ullah Khalid <yasoob.khld@gmail.com> (`@yasoob <https://github.com/yasoob>`_)
+- Josh Brown (`@Montycarlo <https://github.com/Montycarlo>`_)
index 0085345c43d0f84b63f08c643d44b4e6e70c2093..bc804629bf085713a70c4ecc1e77a07e3e234cf9 100644 (file)
@@ -311,8 +311,14 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
         # Catch possible read timeouts thrown as SSL errors. If not the
         # case, rethrow the original. We need to do this because of:
         # http://bugs.python.org/issue10272
-        if 'timed out' in str(err) or 'did not complete (read)' in str(err):  # Python 2.6
-            raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
+        # Wrapped in a try/catch because python 2.7 throws TypeError,
+        # SSLError doesn't override __str__
+        try:
+            if 'timed out' in str(err) or 'did not complete (read)' in str(err):  # Python 2.6
+                raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
+        except TypeError:
+            raise err
+
 
     def _make_request(self, conn, method, url, timeout=_Default,
                       **httplib_request_kw):