Skip to content

feat: add async http client using httpx.AsyncClient#27

Open
fathiaoyinloye wants to merge 1 commit into
ShadeProtocol:mainfrom
fathiaoyinloye:feat/async-counterpart
Open

feat: add async http client using httpx.AsyncClient#27
fathiaoyinloye wants to merge 1 commit into
ShadeProtocol:mainfrom
fathiaoyinloye:feat/async-counterpart

Conversation

@fathiaoyinloye

Copy link
Copy Markdown

closes #8

Description

Implemented an async HTTP client using httpx.AsyncClient while maintaining compatibility with the existing sync client interface.

Changes Made

  • Added _AsyncHTTPClient in src/shade/http.py
  • Implemented async request handling using httpx.AsyncClient
  • Added async lifecycle management through aclose()
  • Extracted shared helper methods (_build_url, _build_headers, _build_request) to reduce duplication between sync and async clients
  • Kept the public AsyncHTTPClient interface for backwards compatibility
  • Added httpx to development dependencies

This change enables the SDK to be used in async frameworks such as FastAPI, Starlette, and Django async views while preserving the existing request and response behavior.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Ran pytest -q

  • Results: 30 passed, 3 skipped

  • Verified async requests return the same JSON-decoded response structure as the sync client

  • Verified await client.aclose() properly closes the async client

  • Confirmed sync and async clients share URL-building and header-generation logic through common helper functions

  • Pytest test suite (pytest -q)

  • Manual verification of async request flow

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas (if applicable)
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement async HTTP client wrapper using httpx

1 participant