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
Built Distribution
File details
Details for the file aiohttp-compress-0.2.1.tar.gz
.
File metadata
- Download URL: aiohttp-compress-0.2.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 915a66e06d142a465850686afce6c282f351ce732744a60131550b4b5d2b6851 |
|
MD5 | fdced41b87cac04ccb64ada226787272 |
|
BLAKE2b-256 | 4f42b8a4d96e281c78d8b911358be850ff785115f565c6233469cb921b314f85 |
File details
Details for the file aiohttp_compress-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: aiohttp_compress-0.2.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19008a2a960499c3f209756d5bcd788868dc411d6c491fd1f63a0d18c916a4f8 |
|
MD5 | bbbf7f48d1fa516aaa85570150cd25c0 |
|
BLAKE2b-256 | 5e376c6396de6ca74135f6ec17c52f37bc4912593bed60df075e7f3af7faea15 |