Add compress to Sanic response as decorator
A Sanic plugin to manage compression as a decorator
pip install sanic-gzip
Usage is as simple as a decorator before your function
from sanic import Sanic from sanic_gzip import compress app = Sanic(__name__) compress = Compress() @app.get("/logs") @compress.compress() async def my_verbose_function(request):
The current version supports both gzip and deflate algorithms.
Config options are to be setted as init argument:
- Compression min. size
- Compression level
- MIME types impacted
- Number of threadused for compression
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for sanic_gzip-0.4.1-py3-none-any.whl