From 4a14378efa36d7a1657c5450d9b18f36f0e24666 Mon Sep 17 00:00:00 2001 From: razze Date: Fri, 23 Oct 2026 12:32:33 +0200 Subject: [PATCH] Use auth.trakt.tv for device login --- resources/lib/traktapi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/lib/traktapi.py b/resources/lib/traktapi.py index 7c6e7830..23404cea 100644 --- a/resources/lib/traktapi.py +++ b/resources/lib/traktapi.py @@ -94,6 +94,7 @@ def __repr__(self) -> str: class TraktClient: api_url = "https://api.trakt.tv" + auth_url = "https://auth.trakt.tv" max_retry_after = 60 def __init__( @@ -120,7 +121,7 @@ def request( include_error_code: bool = False, base_url: str | None = None, ) -> Any: - url = self.api_url + path + url = (base_url or self.api_url) + path data = dumps(body).encode("utf-8") if body is not None else None headers = { "Content-Type": "application/json", @@ -166,6 +167,7 @@ def request( retry=False, include_headers=include_headers, include_error_code=include_error_code, + base_url=base_url, ) if exc.code == 401 and authorization and authorization.get("refresh_token"): raise @@ -241,6 +243,7 @@ def login(self) -> None: "/oauth/device/code", {"client_id": self.client.client_id}, timeout=90, + base_url=self.client.auth_url, ) if not code: @@ -285,6 +288,7 @@ def _poll_device_token(self, code: dict) -> None: }, timeout=90, include_error_code=True, + base_url=self.client.auth_url, ) if token and token.get("access_token"): self.on_authenticated(token)