Quart-Redis
An easy way of setting up a redis connection in quart.
View the docs here.
Requirements
- quart ~= 0.20
- redis >= 5.2.1, < 6
Example
# file: app.py
from quart import Quart
from quart_redis import RedisHandler, get_redis
app = Quart(__name__)
app.config["REDIS_URI"] = "redis://localhost"
# override default connection attempts, set < 0 to disable
# app.config["REDIS_CONN_ATTEMPTS"] = 3
redis_handler = RedisHandler(app)
@app.route("/")
async def index():
redis = get_redis()
val = await redis.get("my-key")
if val is None:
await redis.set("my-key", "it works!")
val = await redis.get("my-key")
return val
Testing
Due to quart_redis using before_serving and after_serving, using the Quart test_client requires the use of test_app. Pytest example shown below:
# file: test.py
import pytest
from app import app
@pytest.fixture(name="my_app", scope="function")
async def _my_app():
async with app.test_app() as test_app:
yield test_app
async def test_redis(my_app):
async with my_app.test_client() as client:
result = await client.get("/")
assert result == b"it works!"
Faking Redis
For development and testing, you may not have a running Redis instance. In this case, the fakeredis package may be installed and then used instead of actual redis by setting USE_FAKE_REDIS environment variable to true at runtime.
Metadata
Release files for quart-redis 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quart-redis-3.0.0.tar.gz | 4.2 kB | With provenance | Details for quart-redis-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quart_redis-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for quart_redis-3.0.0-py3-none-any.whl |
Total release size: 8.5 kB
Release files / quart-redis-3.0.0.tar.gz
| Download URL | quart-redis-3.0.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec45d0535a6a6e0fd79b787173dd3cd51c7af5ab6d0bb285755e19bada56f8f9
|
|
BLAKE2b-256 checksum How to use checksums |
959f065652204f581c446bdb368fd534b275efe2e79a4e118ee2d9c113dfe6b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 22, 2025.
Transparency logRelease files / quart_redis-3.0.0-py3-none-any.whl
| Download URL | quart_redis-3.0.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78a9f16b80e7ca17189a09b022734796bf21a41a4d0c09f05c51acdabc27cd23
|
|
BLAKE2b-256 checksum How to use checksums |
beb80797dc45b917ed47618066ead68c08f7ad0a06375d99e54c89d7a0d43b3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 22, 2025.
Transparency logSecurity for quart-redis 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for quart-redis-3.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 22, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.