mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
fix(api): add User-Agent header to APIs.guru fetch to fix CI 403
APIs.guru CDN blocks requests with Python's default User-Agent (Python-urllib/3.x) from datacenter IPs, causing the weekly Generate API Providers workflow to fail with HTTP 403.
This commit is contained in:
@@ -251,7 +251,8 @@ def fetch_oapis_slop(name: str) -> dict | None:
|
||||
def fetch_apis_guru() -> dict:
|
||||
"""Fetch API list from APIs.guru."""
|
||||
url = "https://api.apis.guru/v2/list.json"
|
||||
with urllib.request.urlopen(url, timeout=60) as response:
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "hanzo-tools-api/0.2"})
|
||||
with urllib.request.urlopen(req, timeout=60) as response:
|
||||
return json.loads(response.read().decode())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user