This module is the simplest way to enable compression support for aiohttp server applications globally.
Project description
aiohttp-compress
This module is the simplest way to enable compression support for aiohttp
server applications globally.
Installation
pip install aiohttp-compress
Example
from aiohttp import web
from aiohttp_compress import compress_middleware
async def handle(request):
name = request.match_info.get(
'name', "Anonymous"
)
text = "Hello, " + name
return web.Response(text=text)
app = web.Application()
app.middlewares.append(compress_middleware)
app.add_routes([
web.get('/', handle),
web.get('/{name}', handle)
])
if __name__ == '__main__':
web.run_app(app)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiohttp-compress-0.1.3.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for aiohttp_compress-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be47a1f32a399d7188148547dd6f66f8e66a55f67f37ad11ba8d1df35513540a |
|
MD5 | e92480ebcf8aa8cf70e3352b52b4d13a |
|
BLAKE2b-256 | 4ca6ff9f0024b4637e4e072f5e67785254e89e899d2aa4e190b28606117ec5fb |