Skip to content

Replace httpx dependency with httpx2, add optional aiohttp support #730

Description

@Hunterlige

Summary

Currently the WorkOS Python SDK depends directly on httpx for making HTTP requests. This issue proposes switching the default HTTP client to httpx2, while also making it possible to optionally use aiohttp as an alternative backend.

httpx has become effectively unmaintained — no releases since 2024, issues and discussions are being closed without resolution. The ecosystem is moving to httpx2, the successor maintained by Pydantic Services Inc. with the original author (Tom Christie). Starlette already migrated (Kludex/starlette#3291, merged May 2026), with the PR author noting:

"httpx has become somehow unmaintained (closing issues, discussions, and no release since 2024), and [httpx2] is the least annoying path forward for every consumer of that package."

Motivation

  • Avoid being tightly coupled to a single HTTP library (httpx), which can cause dependency conflicts for consumers who use a different HTTP stack.
  • httpx2 is being proposed as the new default client library.
  • Some users may prefer or already depend on aiohttp for async workloads, so offering it as an optional backend would reduce friction for those users.

Proposed changes

  1. Remove the hard dependency on httpx and replace it with httpx2 as the default HTTP client used internally.
  2. Introduce an HTTP client abstraction/interface so the underlying library (httpx2 or aiohttp) can be swapped without touching business logic.
  3. Add aiohttp as an optional extra (e.g. pip install workos[aiohttp]) for users who want to use it instead of httpx2.
  4. Update sync/async request handling to work correctly with whichever backend is selected.
  5. Update documentation and README to describe how to select an HTTP backend.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions