Skip to main content

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

Project description

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)

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)

Uploaded Source

Built Distribution

aiohttp_compress-0.2.1-py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page