-
Notifications
You must be signed in to change notification settings - Fork 36
Fix: Replace urllib.request with httpx in SDK hub #515
Copy link
Copy link
Open
Labels
Description
httpx is declared as a runtime dependency in pyproject.toml, but agr/sdk/hub.py uses stdlib urllib.request for all GitHub API calls. This creates an inconsistency — the project pays the cost of the httpx dependency without using it in the SDK.
Proposal
Migrate _github_api_request() in agr/sdk/hub.py to use httpx:
# Before (urllib.request)
request = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(request, timeout=30) as response:
return json.loads(response.read().decode())
# After (httpx)
response = httpx.get(url, headers=headers, timeout=30)
response.raise_for_status()
return response.json()Benefits
- Consistent dependency usage across the project
- Better error handling and timeout support out of the box
- Opens the path toward async support (
httpx.AsyncClient) for the SDK - Simplifies HTTP error code handling (httpx has structured exception types)
Affected files
agr/sdk/hub.py—_github_api_request()and error handling
Context
Identified in architecture audit: docs/contributing/architecture-audit.md
Reactions are currently unavailable