{ "info": { "author": "Christopher De Vries", "author_email": "devries@idolstarastronomer.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Bottle", "Intended Audience :: Developers", "License :: OSI Approved :: Artistic License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application" ], "description": "Bottle Sessions with Redis\n==========================\n\nBottle_session is a session manager for the Bottle microframework that uses a\ncookie to maintain your web session and stores a hash associated with that\ncookie using the redis key-value store. It is designed as a simple Bottle\nplugin.\n\nInstallation\n------------\nInstall using either pip or easy_install:\n\n $ pip install bottle-session\n\nor you can download the latest version from bitbucket:\n\n $ git clone https://devries@bitbucket.org/devries/bottle-session.git\n $ cd bottle-session\n $ python setup.py install\n\nRequirements\n------------\nIn order to use bottle-session you must have both the redis and of course the\nbottle modules installed. I recommend also installing pycrypto, although it is\nnot required. If pycrypto is installed, then the pycrypto random number\ngenerator is used to generate session cookies, otherwise python's internal\nrandom number generator is used.\n\nUsing Bottle-session\n--------------------\nThe first requirement is that you import the bottle_session module:\n\n :::python\n import bottle_session\n import bottle\n\nNext, initialize the plugin:\n\n :::python\n app = bottle.app()\n plugin = bottle_session.SessionPlugin(cookie_lifetime=600)\n app.install(plugin)\n\nThe `cookie_lifetime` parameter is the lifetime of the cookie in seconds, if\nthe lifetime is explicitly set to **None** it will last 1 week. The\n`SessionPlugin` class initializer takes several optional parameters:\n\n- `host` is the host for the redis instance. It defaults to `localhost`.\n- `port` is the port for the redis instance. It defaults to `6379`.\n- `db` is the redis database number. It defaults to `0`.\n- `cookie_name` is the name of the session cookie. It defaults to\n `bottle.session`.\n- `keyword` is the plugin keyword. It defaults to `session`.\n- `password` is the optional password for the redis instance. It defaults to\n none.\n\nTo use the plugin, just add the keyword (`session` by default) to the routed\nmethod:\n\n :::python\n @bottle.route('/')\n def index(session):\n user_name = session.get('name')\n if user_name is not None:\n return \"Hello, %s\"%user_name\n else:\n return \"I don't recognize you.\"\n\n @bottle.route('/set/:user_name')\n def set_name(session,user_name=None):\n if user_name is not None:\n session['name']=user_name\n return \"I recognize you now.\"\n else:\n return \"What was that?\"\n\n bottle.debug(True)\n bottle.run(app=app,host='localhost',port=8888)\n\nIn this example you can set the `name` property of the session cookie to Chris\nby visiting the `http://localhost:8888/set/Chris` and then that value is\nretrieved when you visit `http://localhost:8888/`. \n\nUsing Bottle-session and Bottle-redis\n-------------------------------------\nIf you are using redis for sessions you are likely using redis to store other\ndata as well, and likely use the bottle-redis plugin. You can use both plugins\ntogether, and you can even get them to use the same connection pool.\nInitialize them by creating a connection pool which you attach to each plugin\nobject before installing them into the bottle application as shown below:\n\n :::python\n #!/usr/bin/env python\n import bottle_session\n import bottle_redis\n import bottle\n import redis\n from datetime import datetime\n\n app = bottle.app()\n session_plugin = bottle_session.SessionPlugin()\n redis_plugin = bottle_redis.RedisPlugin()\n\n connection_pool = redis.ConnectionPool(host='localhost', port=6379)\n\n session_plugin.connection_pool = connection_pool\n redis_plugin.redisdb = connection_pool\n app.install(session_plugin)\n app.install(redis_plugin)\n\n @bottle.route('/')\n def index(session,rdb):\n rdb.incr('visitors')\n visitor = rdb.get('visitors')\n last_visit = session['visit']\n session['visit'] = datetime.now().isoformat()\n\n return 'You are visitor %s, your last visit was on %s'%(visitor,last_visit)\n\n bottle.debug(True)\n bottle.run(app=app,host='localhost',port=8888)\n\nAcknowledgments\n---------------\nThanks to Marcel Hellkamp and the bottle community for the framework and to\nSean M. Collins whose bottle-redis package in bottle-extras served as the\ninspiration for this bottle plugin. Thank you to James Burke for\nyour contributions.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/devries/bottle-session", "keywords": "", "license": "Artistic", "maintainer": "", "maintainer_email": "", "name": "bottle-session", "package_url": "https://pypi.org/project/bottle-session/", "platform": "", "project_url": "https://pypi.org/project/bottle-session/", "project_urls": { "Homepage": "https://bitbucket.org/devries/bottle-session" }, "release_url": "https://pypi.org/project/bottle-session/0.9/", "requires_dist": [ "bottle (>=0.9)", "redis" ], "requires_python": "", "summary": "Redis based sessions for bottle.", "version": "0.9" }, "last_serial": 4233168, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "192a9c047d340caa29191ea7be2ae3a0", "sha256": "e35aa08c59a369655a7782fbd3282266c5e6574bb5257959f8ee627474ec49a3" }, "downloads": -1, "filename": "bottle-session-0.1.tar.gz", "has_sig": false, "md5_digest": "192a9c047d340caa29191ea7be2ae3a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6852, "upload_time": "2013-04-27T04:38:00", "url": "https://files.pythonhosted.org/packages/b8/58/c5d2a03dbb0da0406ac4dd2c703d2da1258ed607a531528be07a1719e4d7/bottle-session-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "bff0c2f36a9284db8bcb3461c4ea281d", "sha256": "06168cdd01d503211f8fc4e734eb39f5ba741e64b395d19c07e079d117629a09" }, "downloads": -1, "filename": "bottle-session-0.2.tar.gz", "has_sig": false, "md5_digest": "bff0c2f36a9284db8bcb3461c4ea281d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7150, "upload_time": "2013-04-27T05:00:59", "url": "https://files.pythonhosted.org/packages/44/7a/ee322b7a19f816b06f990f455e9b6f8c6939c661cd415e2c80eee0da7641/bottle-session-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "270023aa1edbcb1eeb5eaef5dcfe9b52", "sha256": "19a7f7a1e55ce2e3f0d47f1c892d9dfb75f2ce58525a33f820cbfca8e317ddb6" }, "downloads": -1, "filename": "bottle-session-0.3.tar.gz", "has_sig": false, "md5_digest": "270023aa1edbcb1eeb5eaef5dcfe9b52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8608, "upload_time": "2013-05-05T15:41:26", "url": "https://files.pythonhosted.org/packages/c4/56/48c16b72e40776bef2db07a6d168dd53f75c3f537066f5709357266a4764/bottle-session-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "21e876d4c0573f94cda51b68de512560", "sha256": "c62fb9348e3cdc3251ece83a0373c159859d435032afa68aa39fefd8f7ba89e1" }, "downloads": -1, "filename": "bottle-session-0.4.tar.gz", "has_sig": false, "md5_digest": "21e876d4c0573f94cda51b68de512560", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8603, "upload_time": "2014-10-03T17:10:51", "url": "https://files.pythonhosted.org/packages/a2/59/a691b81da5f9b8877893b3c95974478249e3a50314af6afb4fc69877baa2/bottle-session-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "a5e9c62dbf8e4370c901e61182b8ab92", "sha256": "7b8f4356b451b49221493d0552eb17fdf816aa8d541d9c45f4449de780e20500" }, "downloads": -1, "filename": "bottle-session-0.5.tar.gz", "has_sig": false, "md5_digest": "a5e9c62dbf8e4370c901e61182b8ab92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8708, "upload_time": "2015-10-15T16:16:17", "url": "https://files.pythonhosted.org/packages/10/cd/97b22a4b691fc37daf8cfade37bb3215591f01dbe6459008532788b5fb64/bottle-session-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "147f598094d77ffc1c682c5dabd7a51c", "sha256": "1edf87ccb4fc4785ed39a6cc35ae532c157f3ef53816023b220ea97ba1243e9e" }, "downloads": -1, "filename": "bottle-session-0.6.tar.gz", "has_sig": false, "md5_digest": "147f598094d77ffc1c682c5dabd7a51c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8696, "upload_time": "2016-06-24T20:47:30", "url": "https://files.pythonhosted.org/packages/24/d6/d47932f39abc48d4c19ac9e986f36ecee91741c74f28075cc3f8d5d6cd43/bottle-session-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "b22c54b3d56a9a81576a3dcb65698de4", "sha256": "93243655824915da1490bacd556b36643e9804ee1b678083cc687499362503dd" }, "downloads": -1, "filename": "bottle-session-0.7.tar.gz", "has_sig": false, "md5_digest": "b22c54b3d56a9a81576a3dcb65698de4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8727, "upload_time": "2017-01-17T03:22:09", "url": "https://files.pythonhosted.org/packages/46/c0/72010c28696d58b7e397d40cf8ee8dd2916daf67c48fa16648dbdbe08dcc/bottle-session-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "456747ee323b8580c9488c8c23679af6", "sha256": "76155590c147a21e07bfffdb9927bbb637cd1b9633409d6cc7e8960292ac8ca2" }, "downloads": -1, "filename": "bottle-session-0.8.tar.gz", "has_sig": false, "md5_digest": "456747ee323b8580c9488c8c23679af6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8903, "upload_time": "2017-01-26T16:45:15", "url": "https://files.pythonhosted.org/packages/80/9a/ad6f1cb428a040e73e145bb879a7f863dfc6cd125d72ea272b5bd82f9413/bottle-session-0.8.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "d87b45420406d796012c932246609aa7", "sha256": "3624991b60d3406fa144437598f5816d271f157fb7383f933582164a44a8fb82" }, "downloads": -1, "filename": "bottle_session-0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "d87b45420406d796012c932246609aa7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5903, "upload_time": "2018-09-03T03:31:11", "url": "https://files.pythonhosted.org/packages/2a/21/d7ecbe0772ca0c90d55385e01526d5a366c12016e1a2845a2c02b337bf9a/bottle_session-0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eeef41cd2dfb0e3b893bb8b848c3ab18", "sha256": "8677c8543748839d70c26bd24c3f468d3e5964c1e108d370df8b9e68764169f0" }, "downloads": -1, "filename": "bottle-session-0.9.tar.gz", "has_sig": false, "md5_digest": "eeef41cd2dfb0e3b893bb8b848c3ab18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9208, "upload_time": "2018-09-03T03:31:12", "url": "https://files.pythonhosted.org/packages/85/22/b4e73619b32472d7f0dd732fed693a51425497d70c50364bb762758e9edc/bottle-session-0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d87b45420406d796012c932246609aa7", "sha256": "3624991b60d3406fa144437598f5816d271f157fb7383f933582164a44a8fb82" }, "downloads": -1, "filename": "bottle_session-0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "d87b45420406d796012c932246609aa7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5903, "upload_time": "2018-09-03T03:31:11", "url": "https://files.pythonhosted.org/packages/2a/21/d7ecbe0772ca0c90d55385e01526d5a366c12016e1a2845a2c02b337bf9a/bottle_session-0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eeef41cd2dfb0e3b893bb8b848c3ab18", "sha256": "8677c8543748839d70c26bd24c3f468d3e5964c1e108d370df8b9e68764169f0" }, "downloads": -1, "filename": "bottle-session-0.9.tar.gz", "has_sig": false, "md5_digest": "eeef41cd2dfb0e3b893bb8b848c3ab18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9208, "upload_time": "2018-09-03T03:31:12", "url": "https://files.pythonhosted.org/packages/85/22/b4e73619b32472d7f0dd732fed693a51425497d70c50364bb762758e9edc/bottle-session-0.9.tar.gz" } ] }