Exceptions and Warnings¶
- exception urllib3.exceptions.BodyNotHttplibCompatible¶
Bases:
HTTPErrorBody should be
http.client.HTTPResponselike (have an fp attribute which returns raw chunks) for read_chunked().
- exception urllib3.exceptions.ClosedPoolError(pool, message)¶
Bases:
PoolErrorRaised when a request enters a pool after the pool has been closed.
- Parameters:
pool (ConnectionPool)
message (str)
- Return type:
None
- exception urllib3.exceptions.ConnectTimeoutError¶
Bases:
TimeoutErrorRaised 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¶
Bases:
HTTPErrorRaised when automatic decoding based on Content-Type fails.
- exception urllib3.exceptions.DependencyWarning¶
Bases:
HTTPWarningWarned when an attempt is made to import a module with missing optional dependencies.
- exception urllib3.exceptions.EmptyPoolError(pool, message)¶
Bases:
PoolErrorRaised when a pool runs out of connections and no more are allowed.
- Parameters:
pool (ConnectionPool)
message (str)
- Return type:
None
- exception urllib3.exceptions.FullPoolError(pool, message)¶
Bases:
PoolErrorRaised when we try to add a connection to a full pool in blocking mode.
- Parameters:
pool (ConnectionPool)
message (str)
- Return type:
None
- exception urllib3.exceptions.HeaderParsingError(defects, unparsed_data)¶
Bases:
HTTPErrorRaised by assert_header_parsing, but we convert it to a log.warning statement.
- exception urllib3.exceptions.HostChangedError(pool, url, retries=3)¶
Bases:
RequestErrorRaised when an existing pool gets a request for a foreign host.
- Parameters:
pool (ConnectionPool)
url (str)
- Return type:
None
- exception urllib3.exceptions.IncompleteRead(partial, expected)¶
Bases:
HTTPError,IncompleteReadResponse length doesn’t match expected Content-Length
Subclass of
http.client.IncompleteReadto allow int value forpartialto avoid creating large objects on streamed reads.
- exception urllib3.exceptions.InsecurePlatformWarning¶
Bases:
SecurityWarningWarned when certain TLS/SSL configuration is not available on a platform.
- exception urllib3.exceptions.InsecureRequestWarning¶
Bases:
SecurityWarningWarned when making an unverified HTTPS request.
- exception urllib3.exceptions.InvalidChunkLength(response, length)¶
Bases:
HTTPError,IncompleteReadInvalid chunk length in a chunked response.
- Parameters:
response (HTTPResponse)
length (bytes)
- Return type:
None
- exception urllib3.exceptions.InvalidHeader¶
Bases:
HTTPErrorThe header provided was somehow invalid.
- exception urllib3.exceptions.LocationParseError(location)¶
Bases:
LocationValueErrorRaised when get_host or similar fails to parse the URL input.
- Parameters:
location (str)
- Return type:
None
- exception urllib3.exceptions.LocationValueError¶
Bases:
ValueError,HTTPErrorRaised when there is something wrong with a given URL input.
- exception urllib3.exceptions.MaxRetryError(pool, url, reason=None)¶
Bases:
RequestErrorRaised when the maximum number of retries is exceeded.
- Parameters:
pool (
HTTPConnectionPool) – The connection poolurl (str) – The requested Url
reason (
Exception) – The underlying error
- Return type:
None
- exception urllib3.exceptions.NameResolutionError(host, conn, reason)¶
Bases:
NewConnectionErrorRaised when host name resolution fails.
- Parameters:
host (str)
conn (HTTPConnection)
reason (socket.gaierror)
- exception urllib3.exceptions.NewConnectionError(conn, message)¶
Bases:
ConnectTimeoutError,HTTPErrorRaised when we fail to establish a new connection. Usually ECONNREFUSED.
- Parameters:
conn (HTTPConnection)
message (str)
- Return type:
None
- property pool: HTTPConnection¶
- exception urllib3.exceptions.NotOpenSSLWarning¶
Bases:
SecurityWarningWarned when using unsupported SSL library
- exception urllib3.exceptions.PoolError(pool, message)¶
Bases:
HTTPErrorBase exception for errors caused within a pool.
- Parameters:
pool (ConnectionPool)
message (str)
- Return type:
None
- exception urllib3.exceptions.ProtocolError¶
Bases:
HTTPErrorRaised when something unexpected happens mid-request/response.
- exception urllib3.exceptions.ProxyError(message, error)¶
Bases:
HTTPErrorRaised when the connection to a proxy fails.
- exception urllib3.exceptions.ProxySchemeUnknown(scheme)¶
Bases:
AssertionError,URLSchemeUnknownProxyManager does not support the supplied scheme
- Parameters:
scheme (str | None)
- Return type:
None
- exception urllib3.exceptions.ProxySchemeUnsupported¶
Bases:
ValueErrorFetching HTTPS resources through HTTPS proxies is unsupported
- exception urllib3.exceptions.ReadTimeoutError(pool, url, message)¶
Bases:
TimeoutError,RequestErrorRaised when a socket timeout occurs while receiving data from a server
- Parameters:
pool (ConnectionPool)
url (str | None)
message (str)
- Return type:
None
- exception urllib3.exceptions.RequestError(pool, url, message)¶
Bases:
PoolErrorBase exception for PoolErrors that have associated URLs.
- Parameters:
pool (ConnectionPool)
url (str | None)
message (str)
- Return type:
None
- exception urllib3.exceptions.ResponseError¶
Bases:
HTTPErrorUsed as a container for an error reason supplied in a MaxRetryError.
- GENERIC_ERROR = 'too many error responses'¶
- SPECIFIC_ERROR = 'too many {status_code} error responses'¶
- exception urllib3.exceptions.ResponseNotChunked¶
Bases:
ProtocolError,ValueErrorResponse needs to be chunked in order to read it as chunks.
- exception urllib3.exceptions.SSLError¶
Bases:
HTTPErrorRaised when SSL certificate fails in an HTTPS connection.
- exception urllib3.exceptions.SecurityWarning¶
Bases:
HTTPWarningWarned when performing security reducing actions
- exception urllib3.exceptions.SystemTimeWarning¶
Bases:
SecurityWarningWarned when system time is suspected to be wrong
- exception urllib3.exceptions.TimeoutError¶
Bases:
HTTPErrorRaised when a socket timeout error occurs.
Catching this error will catch both
ReadTimeoutErrorsandConnectTimeoutErrors.
- exception urllib3.exceptions.TimeoutStateError¶
Bases:
HTTPErrorRaised when passing an invalid state to a timeout
- exception urllib3.exceptions.URLSchemeUnknown(scheme)¶
Bases:
LocationValueErrorRaised when a URL input has an unsupported scheme.
- Parameters:
scheme (str)