pallets-eco / flask-session

Server side session extension for Flask
https://flask-session.readthedocs.io
BSD 3-Clause "New" or "Revised" License
501 stars 239 forks source link

redis option for json serializer #46

Closed devvit closed 6 months ago

devvit commented 8 years ago

To use json instead of pickle for serialize, you' d better set a redis instance like this:

from flask_session import Session, RedisSessionInterface

RedisSessionInterface.serializer = json
rds = redis.Redis(decode_responses=True) # make sure utf8
app.config['SESSION_REDIS'] = rds
mcrowson commented 7 years ago

This issue was moved to mcrowson/flask-session#11

Lxstr commented 7 months ago

Msgspec will be added in 0.7.0 with JSON and Msgpack support. Also note, subclassing interfaces will need to import redis.RedisSessionInterface.

This is a great tip to use for best security until Pickle is fully removed in 1.0.0