Build & Publish Package / publish (push) Successful in 49s
- Add opt-in SESSION_REDIS_JSON storage for asyncio Redis backends. - Check JSON command support at startup and reject JSON mode on Trio. - Read legacy strings and migrate sessions on their next save. - Validate JSON objects before transactional replacement and expiry. - Preserve tagged serialization for datetime, tuple, and other types. - Cover command contracts, error handling, and session round-trips. - Document server requirements, permissions, and migration limits. - Normalize indentation and whitespace across code, tests, and examples. - Bump the package and lockfile to 4.1.0 and update the changelog. - Refresh the locked pycparser dependency to 3.12.
31 lines
523 B
Python
31 lines
523 B
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Hello
|
|
~~~~~
|
|
|
|
Quart-Session demo.
|
|
|
|
:copyright: (c) 2020 by Kroket Ltd.
|
|
:license: BSD, see LICENSE for more details.
|
|
"""
|
|
from quart import Quart, session
|
|
from quart_session import Session
|
|
|
|
SESSION_TYPE = 'redis'
|
|
|
|
app = Quart(__name__)
|
|
app.config.from_object(__name__)
|
|
Session(app)
|
|
|
|
@app.route('/set/')
|
|
async def set():
|
|
session['key'] = 'value'
|
|
return 'ok'
|
|
|
|
@app.route('/get/')
|
|
async def get():
|
|
return session.get('key', 'not set')
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=True)
|