Registry / http-networking / aiohttp-basicauth

aiohttp-basicauth

JSON →
library1.2.0pypypi✓ verified 84d ago

HTTP basic authentication middleware for aiohttp 3.0+. Current version 1.1.0. This library provides a simple middleware to add HTTP basic authentication to aiohttp web applications. Maintenance is infrequent.

pip install aiohttp-basicauth
INSTALL
IMPORT
SIG · AIOHTTP-BASICAUTH
A
aiohttp-basicauth
http-networkingpythonv1.2.0
Install
4.0s avg
Import
635ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.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.666s · 27MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.0s · import 0.604s · 29MB
26MB installed
● package 26MB
Code
Verified usage

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

BasicAuth
from aiohttp_basicauth import BasicAuth
from aiohttp_basicauth_middleware import BasicAuth
common misspelling of package name

Set up basic auth middleware on an aiohttp app.

from aiohttp import web from aiohttp_basicauth import BasicAuth auth = BasicAuth(username='admin', password='secret') async def handler(request): return web.Response(text='Authenticated!') app = web.Application() app.router.add_get('/', handler) auth.setup(app) web.run_app(app)
Debug
Known issues
breakingThe `setup` method configures the middleware globally on the app; you cannot apply per-route auth easily without the `ignore` decorator (added in v1.1.0).
fix
Upgrade to v1.1.0 and use `@auth.ignore` on handlers you want to exclude.
affects: <1.1.0
gotchaThe middleware checks credentials on every request, including static files. If you serve static files publicly, use the `ignore` decorator to exclude those routes.
fix
Apply `@auth.ignore` to static file handlers or use a separate sub-app.
affects: all
deprecatedPassing `check_credentials` callable with a request parameter (old signature) is deprecated. New signature: `check_credentials(username, password)`.
fix
Update your callable to accept only `username` and `password` (no request).
affects: >=0.2.0, <1.0.0
Errors
Common errors & fixes
ImportError: No module named 'aiohttp_basicauth_middleware'
Wrong import path; the package name is `aiohttp-basicauth` but the module is `aiohttp_basicauth`.
fix
Use `from aiohttp_basicauth import BasicAuth`.
TypeError: object NoneType can't be used in 'await' expression
Forgetting to use `await` on an async handler that calls `check_credentials` directly, or misconfiguration.
fix
Ensure your handler is async and you await calls if you override `check_credentials`.
Upgrade
Version history
1.2.0latest on PyPI · released Jun 5, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
50 hits · last 30 days
node
40
OpenAI (training)
1
Resources
aiohttp-basicauth — pip install aiohttp-basicauth · libregistry