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.7+
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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ca1371aa7be3081ce6c31eae82c52e85cff9794e175915a1e73f83731e723f2 |
|
MD5 | da478506abad93f9d42415a32cd88d3c |
|
BLAKE2b-256 | afe203ca9097a5bddecf185c0cc11c53399593f6430535aaab8487f77b7df856 |
Hashes for aiohttp_middlewares-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96037a5d8767ddd2f62c5e9eb76bd25e8c2f341f316424c52ad6b15d2e8e7f79 |
|
MD5 | 6ca2eaa4e2eb9d06b567894cb6cbeeac |
|
BLAKE2b-256 | d7fcd87e23ece972002684de99defcdd2d52290b912621cc8994d8d1d002a324 |