mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
zstd
This commit is contained in:
parent
27b6f0e1ba
commit
a5ab730669
@ -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)
|
||||||
|
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user