Skip to content

feat: add async HTTP transport foundation (Stage 0)#1523

Open
LioriE wants to merge 6 commits intomainfrom
feat/async-http-transport
Open

feat: add async HTTP transport foundation (Stage 0)#1523
LioriE wants to merge 6 commits intomainfrom
feat/async-http-transport

Conversation

@LioriE
Copy link
Copy Markdown
Contributor

@LioriE LioriE commented May 10, 2026

What

Lays the foundation for async support in the Python SDK as the first stage of the async rollout plan.

future_utils.py — three transparent helpers:

  • then(result_or_coro, fn) — applies fn immediately on a sync result, or returns an awaitable that applies it after the coroutine resolves
  • wrap(result, as_awaitable) — wraps a sync value in a coroutine when needed
  • resolve(obj) — awaits if async, returns as-is if sync

HTTPClient — async execution path alongside the existing sync path:

  • Persistent httpx.AsyncClient instance created when async_mode_experimental=True
  • _async_execute_with_retry mirrors the sync retry loop using asyncio.sleep
  • All five public methods (get/post/put/patch/delete) accept async_mode: bool = False; passing True delegates to the async counterpart and returns a coroutine

DescopeClient.__init__ — accepts async_mode_experimental via **kwargs and forwards it to both HTTP client instances, ready for the eventual global-rollout stage

Sync callers are completely unaffected — all existing tests pass unchanged.

Related

descope/etc#5922

Loading
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.

2 participants