Fix: Wikipedia User-Agent (was 403 Forbidden)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-27 23:51:46 +02:00
parent f6caa3091f
commit fdde5d43b3

View File

@@ -44,7 +44,8 @@ async def fetch_wikipedia_image(word: str) -> Optional[str]:
async with httpx.AsyncClient(timeout=10.0) as client:
resp = await client.get(
f"https://en.wikipedia.org/api/rest_v1/page/summary/{query}",
headers={"User-Agent": "BreakPilot/1.0 (education platform)"},
headers={"User-Agent": "BreakPilot/1.0 (https://breakpilot.com; education platform; contact@breakpilot.com)"},
follow_redirects=True,
)
if resp.status_code == 200:
data = resp.json()