Add compress to Sanic response as decorator
Project description
sanic-gzip
A Sanic plugin to manage compression as a decorator
Installation
Install with pip
:
pip install sanic-gzip
Usage
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.
Options
Config options are to be setted as init argument:
- Compression min. size
- Compression level
- MIME types impacted
- Number of threadused for compression
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
sanic_gzip-0.2.0.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for sanic_gzip-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ced07b00bcea5f6a071e6ddf49f33f3c6f64b9507898b39fd185daba2452c954 |
|
MD5 | 078fa18f1adfec38bebf8bc159312c8c |
|
BLAKE2b-256 | ad03aac48a7cdadcd292fad9d089fd7d92bd95ebd6c97b85dbe88f7a429be61d |