breed_enricher: User-Agent für Wikipedia API (Fix 403)

This commit is contained in:
rene 2026-04-24 17:43:16 +02:00
parent 28cad893d1
commit 228dc0170a

View file

@ -174,7 +174,10 @@ async def _fetch_wikimedia_photo(name: str) -> str | None:
"""Sucht ein lizenzfreies Foto via Wikipedia pageimages API (de → en Fallback).""" """Sucht ein lizenzfreies Foto via Wikipedia pageimages API (de → en Fallback)."""
for lang in ("de", "en"): for lang in ("de", "en"):
try: try:
async with httpx.AsyncClient(timeout=8) as client: async with httpx.AsyncClient(
timeout=8,
headers={"User-Agent": "Banyaro/1.0 (https://banyaro.de; mail@banyaro.de) httpx"},
) as client:
resp = await client.get( resp = await client.get(
f"https://{lang}.wikipedia.org/w/api.php", f"https://{lang}.wikipedia.org/w/api.php",
params={ params={