| IOError | RequestException | HTTPError(RequestException) | |
| UnrewindableBodyError(RequestException) | |||
| RetryError(RequestException) | |||
| ConnectionError(RequestException) | ProxyError(ConnectionError) | ||
| SSLError(ConnectionError) | |||
| ConnectTimeout(ConnectionError, Timeout) | |||
| Timeout(RequestException) | ReadTimeout | ||
| URLRequired(RequestException) | |||
| TooManyRedirects(RequestException) | |||
| MissingSchema(RequestException, ValueError) | |||
| InvalidSchema(RequestException,ValueError) | |||
| InvalidURL(RequestException,ValueError) | |||
| InvalidHeader(RequestException,ValueError) | |||
| ChunkedEncodingError(RequestException) | |||
| StreamConsumedError(RequestException,TypeError) | |||
| ContentDecodingError(RequestException,BaseHTTPError) | |||
| RequestsWarning(Warning) | FileModeWarning(RequestsWarning, DeprecationWarning) |
[docs]class RequestException(IOError):
"There was an ambiguous exception that occurred while handling your request."
class ProxyError(ConnectionError):
"""A proxy error occurred."""
class SSLError(ConnectionError):
"""An SSL error occurred."""
class MissingSchema(RequestException, ValueError):
"""The URL schema (e.g. http or https) is missing."""
class InvalidSchema(RequestException, ValueError):
"""See defaults.py for valid schemas."""
class InvalidURL(RequestException, ValueError):
"""The URL provided was somehow invalid."""
class InvalidHeader(RequestException, ValueError):
"""The header value provided was somehow invalid."""
class InvalidProxyURL(InvalidURL):
"""The proxy URL provided is invalid."""
class ChunkedEncodingError(RequestException):
"""The server declared chunked encoding but sent an invalid chunk."""
class ContentDecodingError(RequestException, BaseHTTPError):
"""Failed to decode response content"""
class StreamConsumedError(RequestException, TypeError):
"""The content for this response was already consumed"""
class RetryError(RequestException):
"""Custom retries logic failed"""
class UnrewindableBodyError(RequestException):
"""Requests encountered an error when trying to rewind a body"""
# Warnings
class RequestsWarning(Warning):
"""Base warning for Requests."""
pass
class FileModeWarning(RequestsWarning, DeprecationWarning):
"""A file was opened in text mode, but Requests determined its binary length."""
pass
class RequestsDependencyWarning(RequestsWarning):
"""An imported dependency doesn't match the expected version range."""
pass
本文详细列举了Python请求库Requests中可能遇到的各种异常类型,并对每种异常进行了简要说明,帮助开发者快速定位并解决问题。
1012

被折叠的 条评论
为什么被折叠?



