Fix: dedup BGG-Client nutzt Token; Sync-Filter Jahr+deutscher Titel; Defaults für deutsche Neuerscheinungen
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user