Collection of useful middlewares for aiohttp applications.
Project description
Collection of useful middlewares for aiohttp.web applications.
Works on Python 3.6+
Works with aiohttp 3.5+
BSD licensed
Latest documentation on Read The Docs
Source, issues, and pull requests on GitHub
Quickstart
By default aiohttp.web does not provide many built-in middlewares for standart web-development needs such as: handling errors, shielding view handlers, or providing CORS headers.
aiohttp-middlewares tries to fix this by providing several middlewares that aims to cover most common web-development needs.
For example, to enable CORS headers for http://localhost:8081 origin and handle errors for aiohttp.web application you need to,
from aiohttp import web
from aiohttp_middlewares import (
cors_middleware,
error_middleware,
)
app = web.Application(
middlewares=(
cors_middleware(origins=("http://localhost:8081",)),
error_middleware(),
)
)
Check documentation for all available middlewares and available initialization options.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aiohttp-middlewares-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a58c090ea50f44ae49a8ce1dc79f7366b8b6223f179f499bc97f399751efeed |
|
MD5 | 7e0fa7dba61134bd0924648c983312b7 |
|
BLAKE2b-256 | 5fc38f80640739907ca7db46c7f1eb7e7f189cf23e19a02a85f58f7b732d7d65 |
Hashes for aiohttp_middlewares-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47080da0eaa8dee0f3d26ce781959b077b79dd063f45308f5e93fd4134f1c683 |
|
MD5 | 4f8c3313c6e95d180625e74bdbd3b2ed |
|
BLAKE2b-256 | de3a2df38a92b5c4a919234461502d03b8652b19f3007c31980ca0d941673fe2 |