No project description provided
Project description
Muffin-Session – Implement an user sessions in Muffin Framework.
Requirements
python >= 3.3
Installation
Muffin-Session should be installed using pip:
pip install muffin-session
Usage
Add muffin_session to PLUGINS in your Application configuration.
Setup options if needed (see bellow).
Options
SESSION_DEFAULT_USER_CHECKER – A function which checks logged user (lambda x: x)
SESSION_LOGIN_URL – Redirect URL (‘/login’)
SESSION_SECRET – A secret code (‘Insecuresecret’)
- SESSION_AUTO_LOAD – Load session every request automatically
Session will be loaded into request.session.
Examples
@app.ps.session.user_loader def load_user(_id): """Define your own user loader. """ @app.register('/session') def get_session(request): """ Load session and return it as JSON. """ session = yield from app.ps.session(request) return dict(session) @app.register('/admin') @app.ps.session.user_pass(lambda u: u.is_admin) def admin(request): """ Check for user is admin. """ @app.register('/login') def login(request): """ Login user. """ # ... yield from app.ps.session.login(current_user.pk) @app.register('/logout') """ Logout user. """ # ... yield from app.ps.session.logout(curuser.pk)
Bug tracker
If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/muffin-session/issues
Contributing
Development of Muffin-Session happens at: https://github.com/klen/muffin-session
Contributors
klen (Kirill Klenov)
License
Licensed under a MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file muffin-session-0.0.5.tar.gz
.
File metadata
- Download URL: muffin-session-0.0.5.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10d71e614d640452997993533642982b2433e1c06357095cc47217bfe8381883 |
|
MD5 | 33b0db10b915e22e1e9367a21ba364e2 |
|
BLAKE2b-256 | 3cc7bc95d1dcf083a77167a3bf80c39c99a296581790efc71d27facc19d59a93 |
File details
Details for the file muffin_session-0.0.5-py2.py3-none-any.whl
.
File metadata
- Download URL: muffin_session-0.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12dcf446d0bb92dcf0af60885a4ef3e895150fcbb922079a0adbbb62392f609a |
|
MD5 | 64e090569640ee00290def3fca22dade |
|
BLAKE2b-256 | b368699f7647df2b1193243b5bb7dc269d8bc5192be730d53443602a216a841b |