Fix: Wikipedia User-Agent (was 403 Forbidden)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,8 @@ async def fetch_wikipedia_image(word: str) -> Optional[str]:
|
|||||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||||
resp = await client.get(
|
resp = await client.get(
|
||||||
f"https://en.wikipedia.org/api/rest_v1/page/summary/{query}",
|
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:
|
if resp.status_code == 200:
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user