{"id":13484209,"url":"https://github.com/underyx/flask-redis","last_synced_at":"2025-10-25T05:44:52.233Z","repository":{"id":9103247,"uuid":"10883267","full_name":"underyx/flask-redis","owner":"underyx","description":"A Flask extension for using Redis","archived":false,"fork":false,"pushed_at":"2024-03-04T03:37:53.000Z","size":74,"stargazers_count":436,"open_issues_count":9,"forks_count":71,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-07T18:11:11.062Z","etag":null,"topics":["flask","python","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/underyx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"underyx"}},"created_at":"2013-06-23T11:32:18.000Z","updated_at":"2025-04-01T20:37:48.000Z","dependencies_parsed_at":"2024-06-18T13:38:15.342Z","dependency_job_id":"4b4a845c-b2cb-420e-944d-3e4f72d06891","html_url":"https://github.com/underyx/flask-redis","commit_stats":{"total_commits":88,"total_committers":14,"mean_commits":6.285714285714286,"dds":0.5340909090909092,"last_synced_commit":"3ad7661ad3f59f7580d1fe02de64cd5e876f6854"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/underyx%2Fflask-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/underyx%2Fflask-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/underyx%2Fflask-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/underyx%2Fflask-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/underyx","download_url":"https://codeload.github.com/underyx/flask-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364266,"owners_count":22058877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","python","redis"],"created_at":"2024-07-31T17:01:20.687Z","updated_at":"2025-10-25T05:44:47.194Z","avatar_url":"https://github.com/underyx.png","language":"Python","funding_links":["https://ko-fi.com/underyx"],"categories":["Python"],"sub_categories":[],"readme":"# flask-redis\n\n[![CircleCI](https://circleci.com/gh/underyx/flask-redis.svg?style=svg)](https://circleci.com/gh/underyx/flask-redis)\n[![codecov](https://codecov.io/gh/underyx/flask-redis/branch/master/graph/badge.svg)](https://codecov.io/gh/underyx/flask-redis)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8f8297c1a5f542d49429c4837165984f)](https://www.codacy.com/app/bence/flask-redis?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=underyx/flask-redis\u0026utm_campaign=Badge_Grade)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/underyx/flask-redis.svg)](https://github.com/underyx/flask-redis/tags)\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flask-redis.svg)\n![Flask version support is 0.9+](https://img.shields.io/badge/flask-0.9%2B-blue.svg)\n![redis-py version support is 2.6+](https://img.shields.io/badge/redis--py-2.6%2B-blue.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/ambv/black)\n\nA nice way to use Redis in your Flask app.\n\n## Configuration\n\nStart by installing the extension with `pip install flask-redis`.\nOnce that's done, configure it within your Flask config.\nSet the URL of your Redis instance like this:\n\n```python\nREDIS_URL = \"redis://:password@localhost:6379/0\"\n```\n\nIf you wanna connect to a Unix socket,\nyou can specify it like `\"unix://:password@/path/to/socket.sock?db=0\"`.\n\n## Usage\n\n### Setup\n\nTo add a Redis client to your application:\n\n```python\nfrom flask import Flask\nfrom flask_redis import FlaskRedis\n\napp = Flask(__name__)\nredis_client = FlaskRedis(app)\n```\n\nor if you prefer, you can do it the other way around:\n\n```python\nredis_client = FlaskRedis()\ndef create_app():\n    app = Flask(__name__)\n    redis_client.init_app(app)\n    return app\n```\n\nThe `FlaskRedis` client here will pass its keyword arguments\nto the [`Redis` class](https://redis-py.readthedocs.io/en/latest/#redis.Redis)\nfrom the [`redis-py`](https://github.com/andymccurdy/redis-py) library,\nso all parameters from the `Redis` documentation page will work here as well\n— such as `socket_timeout` and `encoding`.\n\n### Accessing Redis\n\nAccess is done by using `FlaskRedis` as if it was a\n[`Redis` class](https://redis-py.readthedocs.io/en/latest/#redis.Redis)\nas well:\n\n```python\nfrom my_app import redis_client\n\n@app.route('/')\ndef index():\n    return redis_client.get('potato')\n```\n\nFor detailed instructions on what methods you can use on the client,\nas well as how you can use advanced features\nsuch as Lua scripting, pipelines, and callbacks,\nplease check the\n[redis-py documentation](https://redis-py.readthedocs.io/en/latest/).\n\n**Pro-tip:** The [redis-py](https://github.com/andymccurdy/redis-py)\npackage uses the `redis` namespace, so it's nicer to name your Redis object something like `redis_client` instead of just `redis`.\n\n## Extra features in flask-redis\n\n### Custom providers\n\nInstead of the default `Redis` client from `redis-py`,\nyou can provide your own.\nThis can be useful to replace it with [mockredis](https://github.com/locationlabs/mockredis) for testing:\n\n```python\nfrom flask import Flask\nfrom flask_redis import FlaskRedis\nfrom mockredis import MockRedis\n\n\ndef create_app():\n    app = Flask(__name__)\n    if app.testing:\n        redis_store = FlaskRedis.from_custom_provider(MockRedis)\n    else:\n        redis_store = FlaskRedis()\n    redis_store.init_app(app)\n    return app\n```\n\n## Contributing\n\n1. Check for open issues or open a fresh issue to start a discussion\n2. Fork [the repository](https://github.com/underyx/flask-redis) on GitHub.\n3. Send a pull request with your code!\n\nMerging will require a test which shows that the bug was fixed,\nor that the feature works as expected.\nFeel free to open a draft pull request though without such a test\nand ask for help with writing it if you're not sure how to.\n\nAs [Bence](https://underyx.me) (the only maintainer) works full-time,\nplease allow some time before your issue or pull request is handled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderyx%2Fflask-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funderyx%2Fflask-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderyx%2Fflask-redis/lists"}