All Projects → xen → Sanic_session

xen / Sanic_session

Licence: other
Provides server-backed sessions for Sanic using Redis, Memcache and more.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Sanic session

Hfish
安全、可靠、简单、免费的企业级蜜罐
Stars: ✭ 2,977 (+2172.52%)
Mutual labels:  redis, memcache
Gocache
☔️ A complete Go cache library that brings you multiple ways of managing your caches
Stars: ✭ 775 (+491.6%)
Mutual labels:  redis, memcache
Ring
Python cache interface with clean API and built-in memcache & redis + asyncio support.
Stars: ✭ 404 (+208.4%)
Mutual labels:  redis, memcache
Permissions2
🔐 Middleware for keeping track of users, login states and permissions
Stars: ✭ 423 (+222.9%)
Mutual labels:  redis, sessions
Easy Extends
一个简单快速安装PHP扩展的程序--最简单的方法就是使用Linux
Stars: ✭ 85 (-35.11%)
Mutual labels:  redis, memcache
Ninja Mutex
Mutex implementation for PHP
Stars: ✭ 180 (+37.4%)
Mutual labels:  redis, memcache
Middleware development learning
中间件、高性能服务器、分布式存储等(redis、memcache、nginx、大容量redis pika、rocksdb、mongodb、wiredtiger存储引擎、高性能代理中间件)二次开发、性能优化,逐步整理文档说明并配合demo指导--每周末定时更新2-3篇技术文章及程序demo--(技术交流QQ群:568892619)
Stars: ✭ 449 (+242.75%)
Mutual labels:  redis, memcache
Spring Boot Leaning
Spring Boot 2.X 最全课程代码
Stars: ✭ 2,008 (+1432.82%)
Mutual labels:  redis, memcache
Gopherus
This tool generates gopher link for exploiting SSRF and gaining RCE in various servers
Stars: ✭ 1,258 (+860.31%)
Mutual labels:  redis, memcache
Phalcon Vm
Vagrant configuration for PHP7, Phalcon 3.x and Zephir development.
Stars: ✭ 43 (-67.18%)
Mutual labels:  redis, memcache
Synchrotron
Caching layer load balancer.
Stars: ✭ 42 (-67.94%)
Mutual labels:  redis, memcache
Cash
HTTP response caching for Koa. Supports Redis, in-memory store, and more!
Stars: ✭ 122 (-6.87%)
Mutual labels:  redis, sessions
Zebra database
A compact, lightweight and feature-rich PHP MySQLi database wrapper
Stars: ✭ 98 (-25.19%)
Mutual labels:  redis, memcache
Overlord
Overlord是哔哩哔哩基于Go语言编写的memcache和redis&cluster的代理及集群管理功能,致力于提供自动化高可用的缓存服务解决方案。
Stars: ✭ 1,884 (+1338.17%)
Mutual labels:  redis, memcache
Tornadis
async minimal redis client for tornado ioloop designed for performances (use C hiredis parser)
Stars: ✭ 126 (-3.82%)
Mutual labels:  redis
Light Push
轻量级推送服务和实时在线监控平台,同时用于开发即时通信系统,基于node的socket.io,支持web、android、ios客户端,支持移动端离线推送,可进行分布式部署
Stars: ✭ 128 (-2.29%)
Mutual labels:  redis
Vertx Feeds
Feed aggregator using Vert.x 3 (showcase)
Stars: ✭ 127 (-3.05%)
Mutual labels:  redis
Sensu Ansible
An Ansible role to deploy a fully dynamic Sensu stack!
Stars: ✭ 126 (-3.82%)
Mutual labels:  redis
Lowkiq
Ordered background jobs processing
Stars: ✭ 129 (-1.53%)
Mutual labels:  redis
Db Tutorial
💾 db-tutorial 是一个数据库教程。
Stars: ✭ 128 (-2.29%)
Mutual labels:  redis

Sanic session management for humans

ReadTheDocs License: MIT PyPI version

⚠️ Warning: This poject in Pull-Request-Only mode. I don't use Sanic anymore for any of my projects and will not make any changes by my own in foreseeable future. I recommend to use AIOHTTP since it more mature and have bigger adoption (I'm not judging by github stars only). Though I will accept pull requests from others if you want to see updates in the code.

sanic_session is session management extension for Sanic that integrates server-backed sessions with most convenient API.

sanic_session provides a number of session interfaces for you to store a client's session data. The interfaces available right now are:

  • Redis (supports both drivers aioredis and asyncio_redis)
  • Memcache (via aiomcache)
  • Mongodb (via sanic_motor and pymongo)
  • In-Memory (suitable for testing and development environments)

Installation

Install with pip (there is other options for different drivers, check documentation):

pip install sanic_session

or if you prefer Pipenv:

pipenv install sanic_session

Documentation

Documentation is available at sanic-session.readthedocs.io.

Also, make sure you read OWASP's Session Management Cheat Sheet for some really useful info on session management.

Example

A simple example uses the in-memory session interface.

from sanic import Sanic
from sanic.response import text
from sanic_session import Session, InMemorySessionInterface

app = Sanic()
session = Session(app, interface=InMemorySessionInterface())

@app.route("/")
async def index(request):
    # interact with the session like a normal dict
    if not request.ctx.session.get('foo'):
        request.ctx.session['foo'] = 0

    request.ctx.session['foo'] += 1

    return text(request.ctx.session['foo'])

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

Examples of using redis and memcache backed sessions can be found in the documentation, under Using the Interfaces.

— ⭐️ —

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].