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.4.1.tar.gz
(4.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sanic_gzip-0.4.1.tar.gz.
File metadata
- Download URL: sanic_gzip-0.4.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
637998e8b2adb82052122bb28db4ecf4c0e7c3d9aaef8cf04ee81a60287e4a4c
|
|
| MD5 |
90cc1e508cca279589f1b13f42a24f1c
|
|
| BLAKE2b-256 |
44b71f80e8e0eedbb01fa07649a464e73c76181235719d8792c36c4d37151782
|
File details
Details for the file sanic_gzip-0.4.1-py3-none-any.whl.
File metadata
- Download URL: sanic_gzip-0.4.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
899b3f3342d8331894aefccfa54677cb54a39cf384faf7228354c80dee634a60
|
|
| MD5 |
9922db4d6353c87652619813cdae6db3
|
|
| BLAKE2b-256 |
6bc3659cf5b5f58b23a7ffef913a5e77cca16d6c739d5d4455b369e13c432d38
|