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.2.1.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for aiohttp_compress-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19008a2a960499c3f209756d5bcd788868dc411d6c491fd1f63a0d18c916a4f8 |
|
MD5 | bbbf7f48d1fa516aaa85570150cd25c0 |
|
BLAKE2b-256 | 5e376c6396de6ca74135f6ec17c52f37bc4912593bed60df075e7f3af7faea15 |