Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyx/sanic-cookiesession
Simple Cookie-based Session for Sanic
https://github.com/pyx/sanic-cookiesession
sanic session
Last synced: about 2 months ago
JSON representation
Simple Cookie-based Session for Sanic
- Host: GitHub
- URL: https://github.com/pyx/sanic-cookiesession
- Owner: pyx
- License: other
- Created: 2017-04-27T22:20:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-06T06:03:58.000Z (about 1 year ago)
- Last Synced: 2024-10-14T00:51:19.564Z (3 months ago)
- Topics: sanic, session
- Language: Python
- Size: 26.4 KB
- Stars: 7
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
===========================================================
Sanic-CookieSession - Simple Cookie-based Session for Sanic
===========================================================Sanic-CookieSession implements a client side only, cookie-based session to be
used with `Sanic`_. Similar to the built-in session in Flask... warning::
The session cookie is signed cryptographically to prevent modification, but
the content is not encrypted, NEVER store information that need to be kept
secret... _Sanic: https://github.com/channelcat/sanic
Quick Start
===========Installation
------------.. code-block:: sh
pip install Sanic-CookieSession
How to use it
-------------.. code-block:: python
from sanic import Sanic, response
import sanic_cookiesessionapp = Sanic(__name__)
app.config['SESSION_COOKIE_SECRET_KEY'] = 'abcd'sanic_cookiesession.setup(app)
@app.route('/')
def index(request):
session = request.ctx.session
session.setdefault('c', 0)
session['c'] += 1
return response.text(session['c'])if __name__ == '__main__':
app.run(debug=True)That's it.
For more details, please see documentation.
License
=======BSD New, see LICENSE for details.
Links
=====- `Documentation `_
- `Issue Tracker `_
- `Source Package @ PyPI `_
- `Mercurial Repository @ bitbucket
`_- `Git Repository @ Github
`_- `Git Repository @ Gitlab
`_- `Development Version
`_