diff --git a/src/resources/lib/client.py b/src/resources/lib/client.py index a6069bf..be02c2a 100644 --- a/src/resources/lib/client.py +++ b/src/resources/lib/client.py @@ -38,11 +38,6 @@ def https_request(self, request: urllib.request.Request) -> urllib.request.Reque f"Sending {request.get_method()} request to {request.get_full_url()}" ) request.add_header("Authorization", f"Bearer {self.plugin.settings.access_token}") - request.add_header( - "user-agent", - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " - "(KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", - ) self.plugin.logger.debug( f"Get system proxy settings: type={self.plugin.proxy_settings.type}, " f"host={self.plugin.proxy_settings.host}, port={self.plugin.proxy_settings.port}" @@ -186,6 +181,11 @@ def _handle_response( def _make_request(self, request: urllib.request.Request) -> Dict[str, Any]: request.recursion_counter_401 = 0 # type: ignore[attr-defined] request.recursion_counter_429 = 0 # type: ignore[attr-defined] + request.add_header( + "user-agent", + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " + "(KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", + ) try: response = self.opener.open(request, timeout=TIMEOUT) except Exception: