python requests库的所有异常

异常:

以下是request.exceptions模块下的异常错误:

  • RequestException:所有异常的基类。
  • HTTPError(RequestException):HTTP错误。
  • UnrewindableBodyError(RequestException):请求在尝试回放正文时遇到错误。
  • RetryError(RequestException):自定义重试逻辑失败(Custom retries logic failed)。
  • ConnectionError(RequestException):发生连接错误。
  • ProxyError(ConnectionError):发生代理错误。
  • SSLError(ConnectionError):出现SSL错误。
  • ConnectTimeout(ConnectionError, Timeout):链接超时。
  • Timeout(RequestException):请求超时;监听此异常将同时监听ConnectTimeoutReadTimeout异常。
  • ReadTimeout(Timeout):响应超时,服务器在规定的时间内未发送任何数据。
  • URLRequired(RequestException):无效的URL。
  • TooManyRedirects(RequestException):重定向次数太多。
  • MissingSchema(RequestException, ValueError):URL缺少资源类型(例如http、https或ftp)。
  • InvalidSchema(RequestException,ValueError):URL指定的资源类型无效,或不支持的资源类型(See defaults.py for valid schemas.)。
  • InvalidURL(RequestException,ValueError):无效URL。
  • InvalidHeader(RequestException,ValueError):无效的请求头。
  • ChunkedEncodingError(RequestException):服务器声明了分块编码,但发送了无效的分块。(The server declared chunked encoding but sent an invalid chunk.)。
  • StreamConsumedError(RequestException,TypeError):此响应的内容已被使用。
  • ContentDecodingError(RequestException,BaseHTTPError):未能解码响应内容。
  • InvalidJSONError:JSON错误。
  • InvalidProxyURL(InvalidURL):提供的代理URL无效。
警告:

以下是request.exceptions模块下的异常警告:

  • RequestsWarning(Warning):请求的基本警告。
  • FileModeWarning(RequestsWarning, DeprecationWarning):文件以文本模式打开,但请求决定了其二进制长度。
  • RequestsDependencyWarning(RequestsWarning):导入的依赖项与预期的版本范围不匹配。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值