This commit is contained in:
恍兮惚兮 2024-07-09 01:05:57 +08:00
parent 27b6f0e1ba
commit a5ab730669
2 changed files with 7 additions and 1 deletions

View File

@ -54,6 +54,9 @@ def ExceptionFilter(func):
class Requester(Requester_common):
Accept_Encoding = "gzip, deflate, br, zstd"
def raise_for_status(self):
if self.last_error:
raise CURLException(self.last_error)

View File

@ -119,6 +119,7 @@ class ResponseBase:
class Requester_common:
Accept_Encoding = "gzip, deflate, br"
def request(self, *argc) -> ResponseBase: ...
@ -277,7 +278,9 @@ class Session:
verify=False,
cert=None,
):
requester = self.loadrequester()
_h = self.headers.copy()
_h.update({"Accept-Encoding": requester.Accept_Encoding})
if headers:
_h.update(headers)
headers = _h
@ -307,7 +310,7 @@ class Session:
timeout = None
if cookies:
self.cookies.update(cookies)
response = self.loadrequester().request(
response = requester.request(
method,
scheme,
server,