Skip to content

Commit

Permalink
fix user agent headers
Browse files Browse the repository at this point in the history
  • Loading branch information
quarckster committed Mar 9, 2024
1 parent 41f3c45 commit 2a4088f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/resources/lib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2a4088f

Please sign in to comment.