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_AUTO_LOAD – Load session every request automatically
Session will be loaded into request.session.
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’)
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.
If you wish to express your appreciation for the project, you are welcome to send a postcard to:
Kirill Klenov pos. Severny 8-3 MO, Istra, 143500 Russia
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
Hashes for muffin_session-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 019834e991a82e193d76a4e873561b84fdaccdbb2529e8991025951ded46a4e7 |
|
MD5 | f356dbe1dcd3137039683cf390e5f492 |
|
BLAKE2b-256 | c796d175a1bea811ace301d11757c8dc9fd5e6f24858fe06731a8ec64c90d0b6 |