Reusable client middlewares for aiohttp.
aiohttp-client-middlewares is a small, pure-Python collection of ready-to-use client middlewares for aiohttp. It currently provides DigestAuthMiddleware, vendored from aiohttp core; this package is the canonical home for it going forward.
Middlewares plug into aiohttp.ClientSession through the client middleware API introduced in aiohttp 3.12, so they can wrap every outgoing request without subclassing the session.
Installation
$ pip install aiohttp-client-middlewares
This requires aiohttp >= 3.12 (the first release with the client-middleware API and DigestAuthMiddleware) and yarl >= 1.17.0. Both are pulled in automatically.
Supported Python versions: 3.10, 3.11, 3.12, 3.13 and 3.14.
Quickstart
Pass one or more middlewares to aiohttp.ClientSession via the middlewares argument. DigestAuthMiddleware transparently performs the HTTP Digest authentication handshake for every request made with the session:
import asyncio
import aiohttp
from aiohttp_client_middlewares import DigestAuthMiddleware
async def main() -> None:
digest = DigestAuthMiddleware("user", "pass")
async with aiohttp.ClientSession(middlewares=(digest,)) as session:
async with session.get("https://httpbin.org/digest-auth/auth/user/pass") as resp:
print("Status:", resp.status)
print("Body:", await resp.json())
asyncio.run(main())
Documentation
Links
Documentation: https://aiohttp-client-middlewares.readthedocs.io/
Changelog: https://github.com/aio-libs/aiohttp-client-middlewares/blob/master/CHANGES.rst
Issue tracker: https://github.com/aio-libs/aiohttp-client-middlewares/issues
Source code: https://github.com/aio-libs/aiohttp-client-middlewares
Communication channels
aio-libs Discussions: https://github.com/aio-libs/aiohttp-client-middlewares/discussions
Matrix: #aio-libs:matrix.org
License
aiohttp-client-middlewares is offered under the Apache-2.0 license. See the LICENSE file for the full text.
Release files for aiohttp-client-middlewares 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiohttp_client_middlewares-0.1.0.tar.gz | 34.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiohttp_client_middlewares-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.2 kB
Release files / aiohttp_client_middlewares-0.1.0.tar.gz
| Download URL | aiohttp_client_middlewares-0.1.0.tar.gz |
|---|---|
| Size | 34.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15563b0a81ecca4eec8e0744841635437c542f8729598ab51a68ddc03c904e7b
|
|
BLAKE2b-256 checksum How to use checksums |
40554836c52f03c6e3b6d8445b0a18ea94114a4c11c3b485d1c9303865e5ba99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / aiohttp_client_middlewares-0.1.0-py3-none-any.whl
| Download URL | aiohttp_client_middlewares-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51657db1eac7a23feb0d4fc609b95b66471488328bba2e9e1700fa0674240b6c
|
|
BLAKE2b-256 checksum How to use checksums |
c8ae5560d224900c6cb10258e0f2e08ab4e2434026f042a7916f082cbc89ee60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency log