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): class Requester(Requester_common):
Accept_Encoding = "gzip, deflate, br, zstd"
def raise_for_status(self): def raise_for_status(self):
if self.last_error: if self.last_error:
raise CURLException(self.last_error) raise CURLException(self.last_error)

View File

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