Fix: dedup BGG-Client nutzt Token; Sync-Filter Jahr+deutscher Titel; Defaults für deutsche Neuerscheinungen

This commit is contained in:
Flo Hartmann
2026-08-25 17:28:35 +00:00
parent d91402881a
commit 929cea1887
10 changed files with 202 additions and 19 deletions

View File

@@ -192,7 +192,8 @@ class DedupPlugin(BasePlugin):
if not self._bgg_aktiv or self.context is None:
return None
if self._bgg_client is None:
self._bgg_client = BggPruefClient()
token = (os.environ.get("SPIELE_BGG_TOKEN") or "").strip() or None
self._bgg_client = BggPruefClient(token=token)
return self._bgg_client
def _protokolliere(self, ergebnis: PruefErgebnis, user: User | None) -> None:

View File

@@ -33,6 +33,7 @@ class BggPruefClient:
self,
mindestabstand_sekunden: float = 1.0,
*,
token: str | None = None,
transport: httpx.BaseTransport | None = None,
uhr: Callable[[], float] = time.monotonic,
schlafen: Callable[[float], None] = time.sleep,
@@ -42,8 +43,11 @@ class BggPruefClient:
self._zuletzt: float | None = None
self._uhr = uhr
self._schlafen = schlafen
headers: dict[str, str] = {}
if token:
headers["Authorization"] = f"Bearer {token}"
self._client = httpx.Client(
base_url=BASIS_URL, timeout=timeout, transport=transport
base_url=BASIS_URL, timeout=timeout, transport=transport, headers=headers
)
def schliessen(self) -> None: