aiohttp-compress

This module is the simplest way to enable compression support for aiohttp server applications globally.


Keywords
aiohttp, aiohttp-server, asyncio, deflate, gzip
License
Apache-2.0
Install
pip install aiohttp-compress==0.2.1

Documentation

aiohttp-compress

PyPI - License Wheel PyPI PyPI Coverage Status tox

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)