summaryrefslogtreecommitdiffstats
path: root/requests/packages/urllib3/exceptions.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2013-09-29 05:12:56 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2013-09-29 05:12:56 -0400
commit19346fa9068878af516cdb670bea4f791337507b (patch)
tree54d4fa5a82b2e0305f3b050dc1ebb53ec9d82a5d /requests/packages/urllib3/exceptions.py
downloadlastfm-19346fa9068878af516cdb670bea4f791337507b.tar.gz
Initial commit
Diffstat (limited to 'requests/packages/urllib3/exceptions.py')
-rw-r--r--requests/packages/urllib3/exceptions.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/requests/packages/urllib3/exceptions.py b/requests/packages/urllib3/exceptions.py
new file mode 100644
index 0000000..47937f7
--- /dev/null
+++ b/requests/packages/urllib3/exceptions.py
@@ -0,0 +1,45 @@
+# urllib3/exceptions.py
+# Copyright 2008-2011 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
+#
+# This module is part of urllib3 and is released under
+# the MIT License: http://www.opensource.org/licenses/mit-license.php
+
+## Exceptions
+
+class HTTPError(Exception):
+ "Base exception used by this module."
+ pass
+
+
+class SSLError(Exception):
+ "Raised when SSL certificate fails in an HTTPS connection."
+ pass
+
+
+class MaxRetryError(HTTPError):
+ "Raised when the maximum number of retries is exceeded."
+ def __init__(self, url):
+ HTTPError.__init__(self, "Max retries exceeded for url: %s" % url)
+ self.url = url
+
+
+class TimeoutError(HTTPError):
+ "Raised when a socket timeout occurs."
+ pass
+
+
+class HostChangedError(HTTPError):
+ "Raised when an existing pool gets a request for a foreign host."
+ def __init__(self, original_host, new_url, retries=3):
+ HTTPError.__init__(self,
+ "Connection pool with host '%s' tried to open a foreign host: %s" %
+ (original_host, new_url))
+
+ self.original_host = original_host
+ self.new_url = new_url
+ self.retries = retries
+
+
+class EmptyPoolError(HTTPError):
+ "Raised when a pool runs out of connections and no more are allowed."
+ pass