Skip to main content

An asynchronous session backend with mongodb for tornado.

Project description

Torsession is an async && sync session backend with Mongodb for Tornado.

Installation

$ pip install torsession

Example

Async example.

from torsession.async import SessionManager

# Initialize SessionManager
sm = SessionManager(motor.MotorClient())

# create a new session or load a session
session = yield sm.new_session()
session = yield sm.load_session("session id")

# set a key-value pair
yield session.set(key, val)

# get key
val = yield session.get(key)

# delete a key
yield session.delete(key)

# refresh session id
yield session.refresh_id()

# clear a session
yield session.clear()

Sync example.

from torsession.sync import SessionManager

# Initialize SessionManager
sm = SessionManager(pymongo.MotorClient())

# create a new session or load a session
session = sm.new_session()
session = sm.load_session("session id")

# set a key-value pair
session.set(key, val)

# get key
val = session.get(key)

# delete a key
session.delete(key)

# refresh session id
session.refresh_id()

# clear a session
session.clear()

LICENSE

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torsession-0.2.9.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

torsession-0.2.9-py2.7.egg (7.3 kB view details)

Uploaded Egg

File details

Details for the file torsession-0.2.9.tar.gz.

File metadata

  • Download URL: torsession-0.2.9.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for torsession-0.2.9.tar.gz
Algorithm Hash digest
SHA256 5e53d9e747c37e4779781381ebf6133def6dcce0e924e2087772b889e7eb6764
MD5 16487a84da3decf1e69491432851c368
BLAKE2b-256 0cf1bdc80d1e6ac686bb617bd340e4b049dd4c0b1e85e3c4fab69412ff99b197

See more details on using hashes here.

File details

Details for the file torsession-0.2.9-py2.7.egg.

File metadata

File hashes

Hashes for torsession-0.2.9-py2.7.egg
Algorithm Hash digest
SHA256 9eebcd745f3e1b4cf05fa9c222ff8d1905b0a9e096d4237b25cac0996689d571
MD5 a860af5e675d597425bc48a2fe752939
BLAKE2b-256 6aefef883b6c3c9425d36daa49a35f9b0e36c50d292df00bbbaa2aaf19350cdd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page