This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Features

  • Cookie based session for Google App Engine using the NDB datastore

  • Configurable for the following cookie settings
    • Domain
    • Path
    • Secure
    • HttpOnly
    • Expires (timeout)
  • HMAC signature to verify cookie has not been tampered with

  • Autosave option which saves anytime a session value is modified

  • Optional Encryption of cookie data using AES

  • Custom timeout per session

Installation

Vishu is available on PyPi and we recommend installation via pip as a vendored package.

pip install -t libs vishnu

Alternatively download your preferred tagged release and all you should have to include is the vishnu folder.

Configuration

app.yaml

Vishnu will automatically look for and use the following variables from your app.yaml config.

Name Required Default Description
VISHNU_COOKIE_NAME no vishnu The name to use for the cookie. If omitted it omitted it will default vishnu
VISHNU_SECRET yes N/A Secret used for HMAC signature
VISHNU_ENCRYPT_KEY no N/A Key used to encrypt cookie data, it omitted then value will not be encrypted.
VISHNU_DOMAIN no N/A The domain to set the cookie for. If omitted it will default to the domain the cookie was served from.
VISHNU_PATH no / The path to set the cookie for. If omitted it will default to /.
VISHNU_SECURE no true Only send this cookie over SSL.
VISHNU_HTTP_ONLY no true Only allow cookie access via HTTP/HTTPS.
VISHNU_AUTO_SAVE no false Automatically save the session when a value is set.
VISHNU_TIMEOUT no N/A How long until this cookie expires. If omitted it will last for the length of the browser session.

Dependencies

If using encryption you will need to add the following to your app.yaml.

libraries:
- name: pycrypto
  version: "2.6"

WSGI Middleware

To use vishnu you must add it as a middleware to your WSGI application.

from vishnu.middleware import SessionMiddleware
app = SessionMiddleware(app)

Setting a Custom Timeout

Each session uses the default timeout specified in app.yaml but if you want to have particular sessions differ to this you can do the following.

session = vishnu.get_session()
session.timeout = 3600
session.save()

The timeout is in seconds. To set the timeout to expire at the end of this session you can use the vishnu.session.TIMEOUT_SESSION constant.

session = vishnu.get_session()
session.timeout = vishnu.session.TIMEOUT_SESSION
session.save()

Cleaning up Expired Sessions

Add the following to a cron handler.

import vishnu

while not vishnu.delete_expired_sessions():
    pass

You can alter the period after expired sessions are deleted by passing a value in seconds as dormant_for.

You can also alter the amount of sessions to delete per call using the limit argument.

Release History

Release History

1.0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
vishnu-1.0.3-py2.py3-none-any.whl (10.6 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Sep 19, 2016
vishnu-1.0.3.tar.gz (7.9 kB) Copy SHA256 Checksum SHA256 Source Sep 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting