例外情况和警告#
- exception urllib3.exceptions.BodyNotHttplibCompatible#
基类:
HTTPError
身体应该是
http.client.HTTPResponse
READ_CHUNKED()的LIKE(有一个返回原始块的FP属性)。
- exception urllib3.exceptions.ClosedPoolError(pool, message)#
基类:
PoolError
关闭池后请求进入池时引发。
- 参数:
pool (ConnectionPool) --
message (str) --
- 返回类型:
None
- exception urllib3.exceptions.ConnectTimeoutError#
基类:
TimeoutError
当连接到服务器时发生套接字超时时引发
- urllib3.exceptions.ConnectionError#
重命名为Protocolerror,但为向后兼容而别名。
- exception urllib3.exceptions.DependencyWarning#
基类:
HTTPWarning
尝试导入缺少可选依赖项的模块时发出警告。
- exception urllib3.exceptions.EmptyPoolError(pool, message)#
基类:
PoolError
当池连接用完且不允许更多连接时引发。
- 参数:
pool (ConnectionPool) --
message (str) --
- 返回类型:
None
- exception urllib3.exceptions.FullPoolError(pool, message)#
基类:
PoolError
当我们尝试在阻塞模式下将连接添加到已满池时引发。
- 参数:
pool (ConnectionPool) --
message (str) --
- 返回类型:
None
- exception urllib3.exceptions.HeaderParsingError(defects, unparsed_data)#
基类:
HTTPError
由assert_header_解析引发,但我们将其转换为log.warning语句。
- exception urllib3.exceptions.HostChangedError(pool, url, retries=3)#
基类:
RequestError
当现有池收到对外部主机的请求时引发。
- 参数:
pool (ConnectionPool) --
url (str) --
- 返回类型:
None
- exception urllib3.exceptions.IncompleteRead(partial, expected)#
-
响应长度与预期的内容长度不匹配
的子类
http.client.IncompleteRead
要允许的整数值,请执行以下操作partial
以避免在流式读取时创建大对象。
- exception urllib3.exceptions.InsecurePlatformWarning#
-
当某些TLS/SSL配置在平台上不可用时发出警告。
- exception urllib3.exceptions.InsecureRequestWarning#
-
发出未验证的https请求时发出警告。
- exception urllib3.exceptions.InvalidChunkLength(response, length)#
-
分块响应中的块长度无效。
- 参数:
response (HTTPResponse) --
length (bytes) --
- 返回类型:
None
- exception urllib3.exceptions.LocationParseError(location)#
-
当get_host或类似程序无法分析URL输入时引发。
- 参数:
location (str) --
- 返回类型:
None
- exception urllib3.exceptions.LocationValueError#
基类:
ValueError
,HTTPError
当给定的URL输入有问题时引发。
- exception urllib3.exceptions.MaxRetryError(pool, url, reason=None)#
基类:
RequestError
超过最大重试次数时引发。
- 参数:
pool (
HTTPConnectionPool
) -- 连接池url (str) -- 请求的URL
reason (
Exception
) -- 潜在的错误
- 返回类型:
None
- exception urllib3.exceptions.NameResolutionError(host, conn, reason)#
-
在主机名解析失败时引发。
- 参数:
host (str) --
conn (HTTPConnection) --
reason (socket.gaierror) --
- exception urllib3.exceptions.NewConnectionError(conn, message)#
基类:
ConnectTimeoutError
,HTTPError
当我们无法建立新连接时引发。通常是经济上的。
- 参数:
conn (HTTPConnection) --
message (str) --
- 返回类型:
None
- property pool: HTTPConnection#
- exception urllib3.exceptions.NotOpenSSLWarning#
-
使用不受支持的SSL库时发出警告
- exception urllib3.exceptions.PoolError(pool, message)#
基类:
HTTPError
池内导致的错误的基本异常。
- 参数:
pool (ConnectionPool) --
message (str) --
- 返回类型:
None
- 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)#
-
从服务器接收数据时发生套接字超时时引发
- 参数:
pool (ConnectionPool) --
url (str) --
message (str) --
- 返回类型:
None
- exception urllib3.exceptions.RequestError(pool, url, message)#
基类:
PoolError
具有关联URL的池错误的基本异常。
- 参数:
pool (ConnectionPool) --
url (str) --
message (str) --
- 返回类型:
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#
-
需要对响应进行分块,以便将其读取为分块。
- exception urllib3.exceptions.SecurityWarning#
基类:
HTTPWarning
执行安全性降低操作时发出警告
- exception urllib3.exceptions.SystemTimeWarning#
-
当怀疑系统时间错误时发出警告
- exception urllib3.exceptions.TimeoutError#
基类:
HTTPError
发生套接字超时错误时引发。
捕获此错误将同时捕获
ReadTimeoutErrors
和ConnectTimeoutErrors
.