BGG API client: disk cache, rate limiting, 202-queue retry, XML parsing

httpx client with injectable clock/sleep/rng for testability. Successful
responses cached under data/bgg_cache/ keyed by endpoint+params; 202
retries follow the spec schedule (2/5/10/30s, give up after 5); 429/503
get jittered exponential backoff; consecutive requests are spaced
rate_limit_seconds apart. Parsers (via defusedxml, per security hook)
cover search, thing (+stats/+versions), and collection, including the
Not Ranked and error-document cases.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Eric Wagoner
2026-08-01 12:26:03 -04:00
parent d58568cceb
commit 4e1211feb6
6 changed files with 535 additions and 0 deletions
+1
View File
@@ -7,6 +7,7 @@ dependencies = [
"typer>=0.12",
"httpx>=0.27",
"rapidfuzz>=3.9",
"defusedxml>=0.7.1",
]
[project.scripts]