QQQR 网络工具

HTTP 客户端适配器和工具。

封装 aiohttp.ClientSessionClientAdapter,并提供 raise_for_status()get_all_cookie()use_mobile_ua() 以满足 QQQR 的 HTTP 通信需求。

qqqr.utils.net.raise_for_status(response, *accept_code)

raise_for_status() 更严格的检查器。

参数:
  • response (ClientResponse) -- 要检查的客户端响应。

  • accept_code (int) -- Overwrite codes that can be accepted, If not given, default is (200, )

抛出:

aiohttp.ClientResponseError -- 如果状态码不在 accept_code

从响应对象获取所有响应 cookie 的适配器。

返回类型:

Dict[str, str]

qqqr.utils.net.ClientAdapter

ClientSession 的别名