Exceptions — urllib3 1.16 documentation

# Exceptions

Custom exceptions defined by urllib3

exception `urllib3.exceptions.` `ClosedPoolError`(pool, message)

  Raised when a request enters a pool after the pool has been closed.

exception `urllib3.exceptions.` `ConnectTimeoutError`

  Raised when a socket timeout occurs while connecting to a server

`urllib3.exceptions.` `ConnectionError`

  Renamed to ProtocolError but aliased for backwards compatibility.

  alias of `ProtocolError`

exception `urllib3.exceptions.` `DecodeError`

  Raised when automatic decoding based on Content-Type fails.

exception `urllib3.exceptions.` `DependencyWarning`

  Warned when an attempt is made to import a module with missing optional dependencies.

exception `urllib3.exceptions.` `EmptyPoolError`(pool, message)

  Raised when a pool runs out of connections and no more are allowed.

exception `urllib3.exceptions.` `HTTPError`

  Base exception used by this module.

exception `urllib3.exceptions.` `HTTPWarning`

  Base warning used by this module.

exception `urllib3.exceptions.` `HeaderParsingError`(defects, unparsed_data)

  Raised by assert_header_parsing, but we convert it to a log.warning statement.

exception `urllib3.exceptions.` `HostChangedError`(pool, url, retries=3)

  Raised when an existing pool gets a request for a foreign host.

exception `urllib3.exceptions.` `InsecurePlatformWarning`

  Warned when certain SSL configuration is not available on a platform.

exception `urllib3.exceptions.` `InsecureRequestWarning`

  Warned when making an unverified HTTPS request.

exception `urllib3.exceptions.` `LocationParseError`(location)

  Raised when get_host or similar fails to parse the URL input.

exception `urllib3.exceptions.` `LocationValueError`

  Raised when there is something wrong with a given URL input.

exception `urllib3.exceptions.` `MaxRetryError`(pool, url, reason=None)

  Raised when the maximum number of retries is exceeded.

  Parameters: | pool (`HTTPConnectionPool`) – The connection pool url (string) – The requested Url reason (exceptions.Exception) – The underlying error

exception `urllib3.exceptions.` `NewConnectionError`(pool, message)

  Raised when we fail to establish a new connection. Usually ECONNREFUSED.

exception `urllib3.exceptions.` `PoolError`(pool, message)

  Base exception for errors caused within a pool.

exception `urllib3.exceptions.` `ProtocolError`

  Raised when something unexpected happens mid-request/response.

exception `urllib3.exceptions.` `ProxyError`

  Raised when the connection to a proxy fails.

exception `urllib3.exceptions.` `ProxySchemeUnknown`(scheme)

  ProxyManager does not support the supplied scheme

exception `urllib3.exceptions.` `ReadTimeoutError`(pool, url, message)

  Raised when a socket timeout occurs while receiving data from a server

exception `urllib3.exceptions.` `RequestError`(pool, url, message)

  Base exception for PoolErrors that have associated URLs.

exception `urllib3.exceptions.` `ResponseError`

  Used as a container for an error reason supplied in a MaxRetryError.

exception `urllib3.exceptions.` `ResponseNotChunked`

  Response needs to be chunked in order to read it as chunks.

exception `urllib3.exceptions.` `SNIMissingWarning`

  Warned when making a HTTPS request without SNI available.

exception `urllib3.exceptions.` `SSLError`

  Raised when SSL certificate fails in an HTTPS connection.

exception `urllib3.exceptions.` `SecurityWarning`

  Warned when perfoming security reducing actions

exception `urllib3.exceptions.` `SubjectAltNameWarning`

  Warned when connecting to a host with a certificate missing a SAN.

exception `urllib3.exceptions.` `SystemTimeWarning`

  Warned when system time is suspected to be wrong

exception `urllib3.exceptions.` `TimeoutError`

  Raised when a socket timeout error occurs.

  Catching this error will catch both `ReadTimeoutErrors` and `ConnectTimeoutErrors`.

exception `urllib3.exceptions.` `TimeoutStateError`

  Raised when passing an invalid state to a timeout