flask-session icon indicating copy to clipboard operation
flask-session copied to clipboard

redis option for json serializer

Open devvit opened this issue 9 years ago • 1 comments

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

devvit avatar Sep 09 '16 07:09 devvit

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

mcrowson avatar Feb 12 '17 00:02 mcrowson

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

Lxstr avatar Feb 25 '24 07:02 Lxstr