When we later try to get the data, it is pulled as a bytes object out of the database and wrapped again as a string:
For example on that same string above it is pulled out of the database as:
b"b'\x80\x03}q\x00(X\x06\x00\x00\x00_freshq\x01\x89X\x05\x00\x00\x00cardsq\x02X\n\x00\x00\x00PP000007C|q\x03u.'"
As you can see, the binary string is stored again cast as a binary string.
Relevant files:
flask_kvsessioninit.py
Line 186:
# save the session, now its no longer new (or modified)
data = self.serialization_method.dumps(dict(session))
# in this case, data == b'\x80\x03}q\x00(X\x06\x00\x00\x00_freshq\x01\x89X\x05\x00\x00\x00cardsq\x02X\n\x00\x00\x00PP000007C|q\x03u.'
Python 3.5 + MySQL
When data is stored to a session it is pickled and stored as a binary string:
ex:
When we later try to get the data, it is pulled as a bytes object out of the database and wrapped again as a string:
For example on that same string above it is pulled out of the database as:
b"b'\x80\x03}q\x00(X\x06\x00\x00\x00_freshq\x01\x89X\x05\x00\x00\x00cardsq\x02X\n\x00\x00\x00PP000007C|q\x03u.'"
As you can see, the binary string is stored again cast as a binary string.
Relevant files: flask_kvsessioninit.py Line 186:
# in this case, data == b'\x80\x03}q\x00(X\x06\x00\x00\x00_freshq\x01\x89X\x05\x00\x00\x00cardsq\x02X\n\x00\x00\x00PP000007C|q\x03u.'