例外情况和警告#

exception urllib3.exceptions.BodyNotHttplibCompatible#

基类:HTTPError

身体应该是 http.client.HTTPResponse READ_CHUNKED()的LIKE(有一个返回原始块的FP属性)。

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

基类:PoolError

关闭池后请求进入池时引发。

参数:
返回类型:

None

exception urllib3.exceptions.ConnectTimeoutError#

基类:TimeoutError

当连接到服务器时发生套接字超时时引发

urllib3.exceptions.ConnectionError#

重命名为Protocolerror,但为向后兼容而别名。

exception urllib3.exceptions.DecodeError#

基类:HTTPError

基于内容类型的自动解码失败时引发。

exception urllib3.exceptions.DependencyWarning#

基类:HTTPWarning

尝试导入缺少可选依赖项的模块时发出警告。

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

基类:PoolError

当池连接用完且不允许更多连接时引发。

参数:
返回类型:

None

exception urllib3.exceptions.FullPoolError(pool, message)#

基类:PoolError

当我们尝试在阻塞模式下将连接添加到已满池时引发。

参数:
返回类型:

None

exception urllib3.exceptions.HTTPError#

基类:Exception

此模块使用的基异常。

exception urllib3.exceptions.HTTPWarning#

基类:Warning

此模块使用的基本警告。

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

基类:HTTPError

由assert_header_解析引发,但我们将其转换为log.warning语句。

参数:
  • defects (list[MessageDefect]) --

  • unparsed_data (bytes | str | None) --

返回类型:

None

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

基类:RequestError

当现有池收到对外部主机的请求时引发。

参数:
返回类型:

None

exception urllib3.exceptions.IncompleteRead(partial, expected)#

基类:HTTPError, IncompleteRead

响应长度与预期的内容长度不匹配

的子类 http.client.IncompleteRead 要允许的整数值,请执行以下操作 partial 以避免在流式读取时创建大对象。

参数:
  • partial (int) --

  • expected (int) --

返回类型:

None

exception urllib3.exceptions.InsecurePlatformWarning#

基类:SecurityWarning

当某些TLS/SSL配置在平台上不可用时发出警告。

exception urllib3.exceptions.InsecureRequestWarning#

基类:SecurityWarning

发出未验证的https请求时发出警告。

exception urllib3.exceptions.InvalidChunkLength(response, length)#

基类:HTTPError, IncompleteRead

分块响应中的块长度无效。

参数:
返回类型:

None

exception urllib3.exceptions.InvalidHeader#

基类:HTTPError

提供的报头不知何故无效。

exception urllib3.exceptions.LocationParseError(location)#

基类:LocationValueError

当get_host或类似程序无法分析URL输入时引发。

参数:

location (str) --

返回类型:

None

exception urllib3.exceptions.LocationValueError#

基类:ValueError, HTTPError

当给定的URL输入有问题时引发。

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

基类:RequestError

超过最大重试次数时引发。

参数:
返回类型:

None

exception urllib3.exceptions.NameResolutionError(host, conn, reason)#

基类:NewConnectionError

在主机名解析失败时引发。

参数:
exception urllib3.exceptions.NewConnectionError(conn, message)#

基类:ConnectTimeoutError, HTTPError

当我们无法建立新连接时引发。通常是经济上的。

参数:
返回类型:

None

property pool: HTTPConnection#
exception urllib3.exceptions.NotOpenSSLWarning#

基类:SecurityWarning

使用不受支持的SSL库时发出警告

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

基类:HTTPError

池内导致的错误的基本异常。

参数:
返回类型:

None

exception urllib3.exceptions.ProtocolError#

基类:HTTPError

在请求/响应过程中发生意外时引发。

exception urllib3.exceptions.ProxyError(message, error)#

基类:HTTPError

当与代理的连接失败时引发。

参数:
返回类型:

None

original_error: Exception#
exception urllib3.exceptions.ProxySchemeUnknown(scheme)#

基类:AssertionError, URLSchemeUnknown

ProxyManager不支持提供的方案

参数:

scheme (str | None) --

返回类型:

None

exception urllib3.exceptions.ProxySchemeUnsupported#

基类:ValueError

不支持通过HTTPS代理获取HTTPS资源

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

基类:TimeoutError, RequestError

从服务器接收数据时发生套接字超时时引发

参数:
返回类型:

None

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

基类:PoolError

具有关联URL的池错误的基本异常。

参数:
返回类型:

None

exception urllib3.exceptions.ResponseError#

基类:HTTPError

用作maxretryerror中提供的错误原因的容器。

GENERIC_ERROR = 'too many error responses'#
SPECIFIC_ERROR = 'too many {status_code} error responses'#
exception urllib3.exceptions.ResponseNotChunked#

基类:ProtocolError, ValueError

需要对响应进行分块,以便将其读取为分块。

exception urllib3.exceptions.SSLError#

基类:HTTPError

在https连接中的ssl证书失败时引发。

exception urllib3.exceptions.SecurityWarning#

基类:HTTPWarning

执行安全性降低操作时发出警告

exception urllib3.exceptions.SystemTimeWarning#

基类:SecurityWarning

当怀疑系统时间错误时发出警告

exception urllib3.exceptions.TimeoutError#

基类:HTTPError

发生套接字超时错误时引发。

捕获此错误将同时捕获 ReadTimeoutErrorsConnectTimeoutErrors .

exception urllib3.exceptions.TimeoutStateError#

基类:HTTPError

向超时传递无效状态时引发

exception urllib3.exceptions.URLSchemeUnknown(scheme)#

基类:LocationValueError

当URL输入具有不支持的方案时引发。

参数:

scheme (str) --

exception urllib3.exceptions.UnrewindableBodyError#

基类:HTTPError

urllib3在尝试倒带正文时遇到错误

urllib3.disable_warnings(category=<class 'urllib3.exceptions.HTTPWarning'>)#

帮助程序,用于快速禁用所有urllib3警告。

参数:

category (type[Warning]) --

返回类型:

None