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