Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dahlitzflorian/quart-compress
A package to compress responses in your Quart app with gzip
https://github.com/dahlitzflorian/quart-compress
flask gzip-compression package plugin python python-3 python3 quart
Last synced: 2 months ago
JSON representation
A package to compress responses in your Quart app with gzip
- Host: GitHub
- URL: https://github.com/dahlitzflorian/quart-compress
- Owner: DahlitzFlorian
- License: mit
- Created: 2019-10-14T19:31:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-04T17:26:40.000Z (about 4 years ago)
- Last Synced: 2024-10-10T18:15:44.268Z (3 months ago)
- Topics: flask, gzip-compression, package, plugin, python, python-3, python3, quart
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quart-Compress
[![Build Status](https://dev.azure.com/fdahlitz/quart-compress/_apis/build/status/DahlitzFlorian.quart-compress?branchName=master)](https://dev.azure.com/fdahlitz/quart-compress/_build/latest?definitionId=6&branchName=master)
[![codecov](https://codecov.io/gh/DahlitzFlorian/quart-compress/branch/master/graph/badge.svg)](https://codecov.io/gh/DahlitzFlorian/quart-compress)
[![PyPI version](https://badge.fury.io/py/quart-compress2.svg)](https://badge.fury.io/py/quart-compress2)
[![Python Support](https://img.shields.io/badge/Python-3.7%20|%203.8-blue)](https://img.shields.io/badge/Python-3.7%20|%203.8-blue)
![black](https://img.shields.io/badge/code%20style-black-000000.svg)
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)## Description
> Quart is a Python ASGI web microframework.
> It is intended to provide the easiest way to use asyncio functionality in a web context, especially with existing Flask apps.
> This is possible as the Quart API is a superset of the Flask API.-- [Quart Project](https://github.com/pgjones/quart)
As I wanted to seamlessly migrate from Flask to Quart and noticed, that there are a few issues in using [Flask-Compress](https://github.com/shengulong/flask-compress) together with Quart, I decided to create my own Quart-Compress packages, which is based on the Flask-Compress project.
## Installation
Installing the package is as easy as:
```bash
$ pip install quart-compress2
```## Usage
To compress your Quart responses, you only need to compress your Quart object at the beginning using the `Compress` class:
```python
from quart import Quart
from quart_compress import Compressapp = Quart(__name__)
Compress(app)
```If you have to add a bunch of configuration to your application, you may need to instantiate the `Compress` object later using `init_app`:
```python
from quart import Quart
from quart_compress import Compressapp = Quart(__name__)
compress = Compress()
# some more configurations
compress.init_app(app)
```