# Base Exceptions
"Base exception used by this module."
"Base warning used by this module."
"Base exception for errors caused within a pool."
self.pool = pool HTTPError.__init__(self, "%s: %s" % (pool, message))
# For pickling purposes. return self.__class__, (None, None)
"Base exception for PoolErrors that have associated URLs."
self.url = url PoolError.__init__(self, pool, message)
# For pickling purposes. return self.__class__, (None, self.url, None)
"Raised when SSL certificate fails in an HTTPS connection."
"Raised when the connection to a proxy fails."
super(ProxyError, self).__init__(message, error, *args) self.original_error = error
"Raised when automatic decoding based on Content-Type fails."
"Raised when something unexpected happens mid-request/response."
#: Renamed to ProtocolError but aliased for backwards compatibility.
# Leaf Exceptions
"""Raised when the maximum number of retries is exceeded.
:param pool: The connection pool :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool` :param string url: The requested Url :param exceptions.Exception reason: The underlying error
"""
self.reason = reason
message = "Max retries exceeded with url: %s (Caused by %r)" % (url, reason)
RequestError.__init__(self, pool, url, message)
"Raised when an existing pool gets a request for a foreign host."
message = "Tried to open a foreign host with url: %s" % url RequestError.__init__(self, pool, url, message) self.retries = retries
""" Raised when passing an invalid state to a timeout """
""" Raised when a socket timeout error occurs.
Catching this error will catch both :exc:`ReadTimeoutErrors <ReadTimeoutError>` and :exc:`ConnectTimeoutErrors <ConnectTimeoutError>`. """
"Raised when a socket timeout occurs while receiving data from a server"
# This timeout error does not have a URL attached and needs to inherit from the # base HTTPError "Raised when a socket timeout occurs while connecting to a server"
"Raised when we fail to establish a new connection. Usually ECONNREFUSED."
"Raised when a pool runs out of connections and no more are allowed."
"Raised when a request enters a pool after the pool has been closed."
"Raised when there is something wrong with a given URL input."
"Raised when get_host or similar fails to parse the URL input."
message = "Failed to parse: %s" % location HTTPError.__init__(self, message)
self.location = location
"Used as a container for an error reason supplied in a MaxRetryError."
"Warned when performing security reducing actions"
"Warned when connecting to a host with a certificate missing a SAN."
"Warned when making an unverified HTTPS request."
"Warned when system time is suspected to be wrong"
"Warned when certain SSL configuration is not available on a platform."
"Warned when making a HTTPS request without SNI available."
""" Warned when an attempt is made to import a module with missing optional dependencies. """
""" Warned when using an HTTPS proxy and an HTTPS URL. Currently urllib3 doesn't support HTTPS proxies and the proxy will be contacted via HTTP instead. This warning can be fixed by changing your HTTPS proxy URL into an HTTP proxy URL.
If you encounter this warning read this: https://github.com/urllib3/urllib3/issues/1850 """
"Response needs to be chunked in order to read it as chunks."
""" Body should be httplib.HTTPResponse like (have an fp attribute which returns raw chunks) for read_chunked(). """
""" Response length doesn't match expected Content-Length
Subclass of http_client.IncompleteRead to allow int value for `partial` to avoid creating large objects on streamed reads. """
super(IncompleteRead, self).__init__(partial, expected)
def __repr__(self): return "IncompleteRead(%i bytes read, %i more expected)" % ( self.partial, self.expected, )
"The header provided was somehow invalid."
"ProxyManager does not support the supplied scheme" # TODO(t-8ch): Stop inheriting from AssertionError in v2.0.
message = "Not supported proxy scheme %s" % scheme super(ProxySchemeUnknown, self).__init__(message)
"Raised by assert_header_parsing, but we convert it to a log.warning statement."
message = "%s, unparsed data: %r" % (defects or "Unknown", unparsed_data) super(HeaderParsingError, self).__init__(message)
"urllib3 encountered an error when trying to rewind a body" |