Skip to main content

A easy way of setting up a redis in quart

Project description

Quart-Redis

Documentation Status PyPI PyPI - Python Version PyPI - Downloads GitHub GitHub issues GitHub last commit

An easy way of setting up a redis connection in quart.

Requirements

  • quart >= 0.18
  • redis >= 4.2

Example of Use

pip install quart-redis
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

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

quart-redis-2.0.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

quart_redis-2.0.0-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page