Registry / http-networking / httpx-aiohttp

httpx-aiohttp

JSON →
library0.2.0pypypi✓ verified 24d ago

httpx-aiohttp provides an aiohttp-powered transport layer for HTTPX, allowing users to leverage aiohttp's robust asynchronous HTTP capabilities within the familiar HTTPX API. It is currently at version 0.1.12 and is actively maintained with frequent minor releases addressing compatibility and bug fixes.

pip install httpx-aiohttp
INSTALL
IMPORT
SIG · HTTPX-AIOHTTP
H
httpx-aiohttp
http-networkingpythonv0.2.0
Install
4.6s avg
Import
665ms
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.692s · 30.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.6s · import 0.638s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AiohttpTransport
from httpx_aiohttp import AiohttpTransport
from httpx_aiohttp import HttpxAiohttpTransport
HttpxAiohttpClient
from httpx_aiohttp import HttpxAiohttpClient

This example demonstrates how to create an `httpx.AsyncClient` that uses `HttpxAiohttpTransport` to perform an asynchronous GET request to `httpbin.org`.

import asyncio import httpx from httpx_aiohttp import HttpxAiohttpTransport async def main(): # Initialize the aiohttp-powered transport transport = HttpxAiohttpTransport() # Create an httpx AsyncClient using the custom transport async with httpx.AsyncClient(transport=transport) as client: try: response = await client.get("https://httpbin.org/get") response.raise_for_status() # Raise an exception for HTTP errors print(f"Status Code: {response.status_code}") print(f"Response JSON: {response.json()}") except httpx.HTTPStatusError as e: print(f"HTTP error occurred: {e}") except httpx.RequestError as e: print(f"An error occurred while requesting: {e}") if __name__ == "__main__": asyncio.run(main())
Debug
Known issues
deprecatedWhen providing Basic Authentication credentials to `httpx.Client` or `httpx.AsyncClient`, passing a `(username, password)` tuple directly is deprecated in favor of using `httpx.BasicAuth`. This applies even when using `httpx-aiohttp` as the transport.
fix
Update authentication to use `httpx.BasicAuth('username', 'password')` instead of `('username', 'password')` tuple.
affects: <0.1.10
gotchaVersions prior to 0.1.9 might not properly close the underlying `aiohttp` response after reading content, potentially leading to resource leaks or unreleased connections in long-running applications.
fix
Upgrade to `httpx-aiohttp` version 0.1.9 or newer to ensure proper resource management.
affects: <0.1.9
gotchaEarly versions (prior to 0.1.11/0.1.12) had compatibility issues with Python 3.8, specifically related to the usage of the `|` operator for type hinting. Users on Python 3.8 might encounter syntax errors or unexpected behavior.
fix
Ensure you are using `httpx-aiohttp` version 0.1.12 or newer for full Python 3.8 compatibility.
affects: <0.1.12
gotchaVersions prior to 0.1.8 might incorrectly include a `Content-Type` header in HTTP GET requests even when no request body is present. This could cause issues with servers that are strict about request header correctness.
fix
Upgrade to `httpx-aiohttp` version 0.1.8 or newer to ensure `Content-Type` is correctly omitted for empty GET requests.
affects: <0.1.8
gotchaThe `aiohttp` library, which this transport leverages, does not inherently support HTTP/2. Therefore, when using `httpx-aiohttp`, any HTTP/2 features expected from a standard `httpx` client will not be available. The transport will revert to HTTP/1.1 communication.
fix
Be aware that HTTP/2 is not supported when using this transport. If HTTP/2 is required, a different `httpx` transport or client may be necessary.
affects: All versions
Upgrade
Version history
0.2.0latest on PyPI · released Jul 25, 2026
Audit
Dependencies
httpxrequiredCore HTTP client library that httpx-aiohttp extends for transport functionality.
aiohttprequiredUnderlying asynchronous HTTP client providing the transport implementation.
Agent activity
13 hits · last 30 days
node
12
Resources