Collection of useful middlewares for aiohttp applications.
Project description
Collection of useful middlewares for aiohttp.web applications.
Works on Python 3.7+
Works with aiohttp.web 3.8.1+
BSD licensed
Latest documentation on Read The Docs
Source, issues, and pull requests on GitHub
Quick Start
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-2.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5863970d944dc63faedc96ef324a7fe2bcefefebe29acc90cd641236322d00c3 |
|
MD5 | fef3e59a63a3d69f2bf8ff47db166830 |
|
BLAKE2b-256 | 7e8c9a34a9ab658bcc50405d95e1a1229f0d6432682b2cf6da8fb3579ecbc354 |
Hashes for aiohttp_middlewares-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c83d48702e6a8669981976f39a60e83d059dc01d7b1ee651aec5d4cb807ff784 |
|
MD5 | 7b53ab26af1cf8956ff26dd13ea033b6 |
|
BLAKE2b-256 | d01f8e7b1e1e812628f8bd338784380212568117042b2e11821062f8482652a7 |