From 099fb4764da56d580b127b8cff2b98241d06c0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Sat, 13 Jul 2024 17:19:29 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/requests.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LunaTranslator/LunaTranslator/requests.py b/LunaTranslator/LunaTranslator/requests.py index ec269bb6..c7823ca5 100644 --- a/LunaTranslator/LunaTranslator/requests.py +++ b/LunaTranslator/LunaTranslator/requests.py @@ -322,6 +322,9 @@ class Session: from network.winhttp.requester import Requester self._requester = Requester() self._libidx = globalconfig["network"] + + self.headers.update({"Accept-Encoding": self.requester.Accept_Encoding}) + self.headers.update({"User-Agent": self.requester.default_UA}) return self._requester def request( @@ -347,8 +350,6 @@ class Session: if cookies: self.cookies.update(cookies) _h = self.headers.copy() - _h.update({"Accept-Encoding": self.requester.Accept_Encoding}) - _h.update({"User-Agent": self.requester.default_UA}) if headers: _h.update(headers) response = self.requester.request(