Translate urllib3 ProxyError into a requests ProxyError derived from ConnectionError.
authorGraham Dumpleton <Graham.Dumpleton@gmail.com>
Fri, 4 Oct 2013 06:07:11 +0000 (16:07 +1000)
committerGraham Dumpleton <Graham.Dumpleton@gmail.com>
Fri, 4 Oct 2013 06:07:11 +0000 (16:07 +1000)
requests/adapters.py
requests/exceptions.py

index d557b74629946152902e1493bbb0375fe8873e1f..7a0505ba1659048c38c899fdc701aab6177371b7 100644 (file)
@@ -22,8 +22,9 @@ from .packages.urllib3.exceptions import MaxRetryError
 from .packages.urllib3.exceptions import TimeoutError
 from .packages.urllib3.exceptions import SSLError as _SSLError
 from .packages.urllib3.exceptions import HTTPError as _HTTPError
+from .packages.urllib3.exceptions import ProxyError as _ProxyError
 from .cookies import extract_cookies_to_jar
-from .exceptions import ConnectionError, Timeout, SSLError
+from .exceptions import ConnectionError, Timeout, SSLError, ProxyError
 from .auth import _basic_auth_str
 
 DEFAULT_POOLBLOCK = False
@@ -353,6 +354,9 @@ class HTTPAdapter(BaseAdapter):
         except MaxRetryError as e:
             raise ConnectionError(e)
 
+        except _ProxyError as e:
+            raise ProxyError(e)
+
         except (_SSLError, _HTTPError) as e:
             if isinstance(e, _SSLError):
                 raise SSLError(e)
index 22207e35394902043453133574a844db630214a5..bc42b5fff0845e1dad255988cd2734da9ca20880 100644 (file)
@@ -27,6 +27,10 @@ class ConnectionError(RequestException):
     """A Connection error occurred."""
 
 
+class ProxyError(ConnectionError):
+    """A proxy error occurred."""
+
+
 class SSLError(ConnectionError):
     """An SSL error occurred."""