breed_enricher: User-Agent für Wikipedia API (Fix 403)
This commit is contained in:
parent
28cad893d1
commit
228dc0170a
1 changed files with 4 additions and 1 deletions
|
|
@ -174,7 +174,10 @@ async def _fetch_wikimedia_photo(name: str) -> str | None:
|
|||
"""Sucht ein lizenzfreies Foto via Wikipedia pageimages API (de → en Fallback)."""
|
||||
for lang in ("de", "en"):
|
||||
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(
|
||||
f"https://{lang}.wikipedia.org/w/api.php",
|
||||
params={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue