例外情况¶
-
exception
urllib3.exceptions.
BodyNotHttplibCompatible
¶ 基类:
urllib3.exceptions.HTTPError
body应该与httplib.httpresponse类似(具有返回原始块的fp属性),用于read_chunked()。
-
exception
urllib3.exceptions.
ClosedPoolError
(pool, message)¶ 基类:
urllib3.exceptions.PoolError
关闭池后请求进入池时引发。
-
exception
urllib3.exceptions.
ConnectTimeoutError
¶ 基类:
urllib3.exceptions.TimeoutError
当连接到服务器时发生套接字超时时引发
-
urllib3.exceptions.
ConnectionError
¶ 重命名为Protocolerror,但为向后兼容而别名。
-
exception
urllib3.exceptions.
DecodeError
¶ 基类:
urllib3.exceptions.HTTPError
基于内容类型的自动解码失败时引发。
-
exception
urllib3.exceptions.
DependencyWarning
¶ 基类:
urllib3.exceptions.HTTPWarning
尝试导入缺少可选依赖项的模块时发出警告。
-
exception
urllib3.exceptions.
EmptyPoolError
(pool, message)¶ 基类:
urllib3.exceptions.PoolError
当池连接用完且不允许更多连接时引发。
-
exception
urllib3.exceptions.
HeaderParsingError
(defects, unparsed_data)¶ 基类:
urllib3.exceptions.HTTPError
由assert_header_解析引发,但我们将其转换为log.warning语句。
-
exception
urllib3.exceptions.
HostChangedError
(pool, url, retries=3)¶ 基类:
urllib3.exceptions.RequestError
当现有池收到对外部主机的请求时引发。
-
exception
urllib3.exceptions.
IncompleteRead
(partial, expected)¶ 基类:
urllib3.exceptions.HTTPError
,http.client.IncompleteRead
响应长度与预期的内容长度不匹配
http_client.incompleteread的子类,允许 partial 避免在流式读取上创建大型对象。
-
exception
urllib3.exceptions.
InsecurePlatformWarning
¶ 基类:
urllib3.exceptions.SecurityWarning
当某个SSL配置在平台上不可用时发出警告。
-
exception
urllib3.exceptions.
InsecureRequestWarning
¶ 基类:
urllib3.exceptions.SecurityWarning
发出未验证的https请求时发出警告。
-
exception
urllib3.exceptions.
InvalidHeader
¶ 基类:
urllib3.exceptions.HTTPError
提供的报头不知何故无效。
-
exception
urllib3.exceptions.
LocationParseError
(location)¶ 基类:
urllib3.exceptions.LocationValueError
当get_host或类似程序无法分析URL输入时引发。
-
exception
urllib3.exceptions.
LocationValueError
¶ 基类:
ValueError
,urllib3.exceptions.HTTPError
当给定的URL输入有问题时引发。
-
exception
urllib3.exceptions.
MaxRetryError
(pool, url, reason=None)¶ 基类:
urllib3.exceptions.RequestError
超过最大重试次数时引发。
- 参数
pool (
HTTPConnectionPool
) -- 连接池url (string) -- 请求的URL
reason (exceptions.Exception) -- 潜在的错误
-
exception
urllib3.exceptions.
NewConnectionError
(pool, message)¶ 基类:
urllib3.exceptions.ConnectTimeoutError
,urllib3.exceptions.PoolError
当我们无法建立新连接时引发。通常是经济上的。
-
exception
urllib3.exceptions.
PoolError
(pool, message)¶ 基类:
urllib3.exceptions.HTTPError
池内导致的错误的基本异常。
-
exception
urllib3.exceptions.
ProtocolError
¶ 基类:
urllib3.exceptions.HTTPError
在请求/响应过程中发生意外时引发。
-
exception
urllib3.exceptions.
ProxyError
¶ 基类:
urllib3.exceptions.HTTPError
当与代理的连接失败时引发。
-
exception
urllib3.exceptions.
ProxySchemeUnknown
(scheme)¶ -
ProxyManager不支持提供的方案
-
exception
urllib3.exceptions.
ReadTimeoutError
(pool, url, message)¶ 基类:
urllib3.exceptions.TimeoutError
,urllib3.exceptions.RequestError
从服务器接收数据时发生套接字超时时引发
-
exception
urllib3.exceptions.
RequestError
(pool, url, message)¶ 基类:
urllib3.exceptions.PoolError
具有关联URL的池错误的基本异常。
-
exception
urllib3.exceptions.
ResponseError
¶ 基类:
urllib3.exceptions.HTTPError
用作maxretryerror中提供的错误原因的容器。
-
GENERIC_ERROR
= 'too many error responses'¶
-
SPECIFIC_ERROR
= 'too many {status_code} error responses'¶
-
-
exception
urllib3.exceptions.
ResponseNotChunked
¶ 基类:
urllib3.exceptions.ProtocolError
,ValueError
需要对响应进行分块,以便将其读取为分块。
-
exception
urllib3.exceptions.
SNIMissingWarning
¶ 基类:
urllib3.exceptions.HTTPWarning
在不提供sni的情况下发出https请求时发出警告。
-
exception
urllib3.exceptions.
SSLError
¶ 基类:
urllib3.exceptions.HTTPError
在https连接中的ssl证书失败时引发。
-
exception
urllib3.exceptions.
SecurityWarning
¶ 基类:
urllib3.exceptions.HTTPWarning
执行安全性降低操作时发出警告
-
exception
urllib3.exceptions.
SubjectAltNameWarning
¶ 基类:
urllib3.exceptions.SecurityWarning
当连接到缺少证书的主机时,会发出警告。
-
exception
urllib3.exceptions.
SystemTimeWarning
¶ 基类:
urllib3.exceptions.SecurityWarning
当怀疑系统时间错误时发出警告
-
exception
urllib3.exceptions.
TimeoutError
¶ 基类:
urllib3.exceptions.HTTPError
发生套接字超时错误时引发。
捕获此错误将同时捕获
ReadTimeoutErrors
和ConnectTimeoutErrors
.
-
exception
urllib3.exceptions.
TimeoutStateError
¶ 基类:
urllib3.exceptions.HTTPError
向超时传递无效状态时引发
-
exception
urllib3.exceptions.
UnrewindableBodyError
¶ 基类:
urllib3.exceptions.HTTPError
urllib3在尝试倒带正文时遇到错误