Skip to main content

Add compress to Sanic response as decorator

Project description


A Sanic plugin to manage compression as a decorator


Install with pip:

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()

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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sanic-gzip, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size sanic_gzip-0.3.0-py3-none-any.whl (4.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sanic_gzip-0.3.0.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page