Lesson 17 / 18
Redis in a Python App
Talk to Redis from Python with the redis-py client.
Install the client
redis-py is the standard, well-maintained client for Python.
pip install redisConnect & use it
decode_responses=True returns plain Python strings instead of bytes — one less thing to convert.
import redis
r = redis.Redis(host="localhost", port=6379, decode_responses=True)
r.set("greeting", "hello", ex=60)
print(r.get("greeting")) # hello