Exceptions
Custom exceptions defined by urllib3
-
exception urllib3.exceptions.BodyNotHttplibCompatible[source]
Body should be http.client.HTTPResponse
like
(have an fp attribute which returns raw chunks) for read_chunked().
-
exception urllib3.exceptions.ClosedPoolError(pool: ConnectionPool, message: str)[source]
Raised when a request enters a pool after the pool has been closed.
-
exception urllib3.exceptions.ConnectTimeoutError[source]
Raised when a socket timeout occurs while connecting to a server
-
urllib3.exceptions.ConnectionError
Renamed to ProtocolError but aliased for backwards compatibility.
-
exception urllib3.exceptions.DecodeError[source]
Raised when automatic decoding based on Content-Type fails.
-
exception urllib3.exceptions.DependencyWarning[source]
Warned when an attempt is made to import a module with missing optional
dependencies.
-
exception urllib3.exceptions.EmptyPoolError(pool: ConnectionPool, message: str)[source]
Raised when a pool runs out of connections and no more are allowed.
-
exception urllib3.exceptions.FullPoolError(pool: ConnectionPool, message: str)[source]
Raised when we try to add a connection to a full pool in blocking mode.
-
exception urllib3.exceptions.HTTPError[source]
Base exception used by this module.
-
exception urllib3.exceptions.HTTPWarning[source]
Base warning used by this module.
Raised by assert_header_parsing, but we convert it to a log.warning statement.
-
exception urllib3.exceptions.HostChangedError(pool: ConnectionPool, url: str, retries: Retry | int = 3)[source]
Raised when an existing pool gets a request for a foreign host.
-
exception urllib3.exceptions.IncompleteRead(partial: int, expected: int)[source]
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.
-
exception urllib3.exceptions.InsecurePlatformWarning[source]
Warned when certain TLS/SSL configuration is not available on a platform.
-
exception urllib3.exceptions.InsecureRequestWarning[source]
Warned when making an unverified HTTPS request.
-
exception urllib3.exceptions.InvalidChunkLength(response: HTTPResponse, length: bytes)[source]
Invalid chunk length in a chunked response.
The header provided was somehow invalid.
-
exception urllib3.exceptions.LocationParseError(location: str)[source]
Raised when get_host or similar fails to parse the URL input.
-
exception urllib3.exceptions.LocationValueError[source]
Raised when there is something wrong with a given URL input.
-
exception urllib3.exceptions.MaxRetryError(pool: ConnectionPool, url: str, reason: Exception | None = None)[source]
Raised when the maximum number of retries is exceeded.
- Parameters:
pool (HTTPConnectionPool
) – The connection pool
url (str) – The requested Url
reason (Exception
) – The underlying error
-
exception urllib3.exceptions.NameResolutionError(host: str, conn: HTTPConnection, reason: socket.gaierror)[source]
Raised when host name resolution fails.
-
exception urllib3.exceptions.NewConnectionError(conn: HTTPConnection, message: str)[source]
Raised when we fail to establish a new connection. Usually ECONNREFUSED.
-
exception urllib3.exceptions.NotOpenSSLWarning[source]
Warned when using unsupported SSL library
-
exception urllib3.exceptions.PoolError(pool: ConnectionPool, message: str)[source]
Base exception for errors caused within a pool.
-
exception urllib3.exceptions.ProtocolError[source]
Raised when something unexpected happens mid-request/response.
-
exception urllib3.exceptions.ProxyError(message: str, error: Exception)[source]
Raised when the connection to a proxy fails.
-
exception urllib3.exceptions.ProxySchemeUnknown(scheme: str | None)[source]
ProxyManager does not support the supplied scheme
-
exception urllib3.exceptions.ProxySchemeUnsupported[source]
Fetching HTTPS resources through HTTPS proxies is unsupported
-
exception urllib3.exceptions.ReadTimeoutError(pool: ConnectionPool, url: str, message: str)[source]
Raised when a socket timeout occurs while receiving data from a server
-
exception urllib3.exceptions.RequestError(pool: ConnectionPool, url: str, message: str)[source]
Base exception for PoolErrors that have associated URLs.
-
exception urllib3.exceptions.ResponseError[source]
Used as a container for an error reason supplied in a MaxRetryError.
-
exception urllib3.exceptions.ResponseNotChunked[source]
Response needs to be chunked in order to read it as chunks.
-
exception urllib3.exceptions.SSLError[source]
Raised when SSL certificate fails in an HTTPS connection.
-
exception urllib3.exceptions.SecurityWarning[source]
Warned when performing security reducing actions
-
exception urllib3.exceptions.SystemTimeWarning[source]
Warned when system time is suspected to be wrong
-
exception urllib3.exceptions.TimeoutError[source]
Raised when a socket timeout error occurs.
Catching this error will catch both ReadTimeoutErrors
and ConnectTimeoutErrors
.
-
exception urllib3.exceptions.TimeoutStateError[source]
Raised when passing an invalid state to a timeout
-
exception urllib3.exceptions.URLSchemeUnknown(scheme: str)[source]
Raised when a URL input has an unsupported scheme.
-
exception urllib3.exceptions.UnrewindableBodyError[source]
urllib3 encountered an error when trying to rewind a body