Skip to content

jaanos/bottlesession

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

bottlesession

This project adds simple session management to Bottle Python.

To use this, just add the following import statement to any bottle project:

from bottlesession import session

To initialize a session just create a new session object.

sess = session()

You can also specify a secret key for Bottle to use when signing the cookie.

sess = session('reallySecurePasskey')

If the user has already used a session on your server, he/she will automatically have their session variables placed back into the object, from file.

To add/update/read session variables, use the following methods.

sess.set('user','name')
sess.read('user')

When you're done, make sure you close the session so that the variables get written to disk.

sess.close()

When the user returns to your site, their session will be reloaded as soon as you initialize the session object.

If you do not wish to store sessions to disk (i.e., they will only exist as long as Bottle is running), you may change this setting.

from bottlesession import sessionSettings
sessionsettings["store"] = False

About

Adds session management to Bottle Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%