Description
An async counterpart to the sync client using httpx.AsyncClient, enabling use in async frameworks like FastAPI, Starlette, and Django async views. It should share the same configuration and interface as the sync client so resource methods can delegate to either with minimal branching.
Proposed Steps
- Add
_AsyncHTTPClient to http_client.py, mirroring the sync interface with async def request(...).
- Accept the same constructor arguments as
_SyncHTTPClient.
- Use
async with httpx.AsyncClient(...) as client lifecycle management.
- Extract a shared
_build_request(method, path, params, json) helper used by both sync and async versions.
Acceptance Criteria
await client.request("GET", "/payments") returns the same response shape as the sync version.
- The async client can be used in a
pytest-asyncio test without event loop conflicts.
- Closing the async client (via
aclose()) is properly awaited.
- Sync and async clients share URL-building and header logic without duplication.
Description
An async counterpart to the sync client using
httpx.AsyncClient, enabling use in async frameworks like FastAPI, Starlette, and Django async views. It should share the same configuration and interface as the sync client so resource methods can delegate to either with minimal branching.Proposed Steps
_AsyncHTTPClienttohttp_client.py, mirroring the sync interface withasync def request(...)._SyncHTTPClient.async with httpx.AsyncClient(...) as clientlifecycle management._build_request(method, path, params, json)helper used by both sync and async versions.Acceptance Criteria
await client.request("GET", "/payments")returns the same response shape as the sync version.pytest-asynciotest without event loop conflicts.aclose()) is properly awaited.