{"id":21491626,"url":"https://github.com/mitchellchu/torndsession","last_synced_at":"2025-07-15T17:32:29.025Z","repository":{"id":20210134,"uuid":"23481649","full_name":"MitchellChu/torndsession","owner":"MitchellChu","description":"Torndsession is a tornado web framework session extension.","archived":false,"fork":false,"pushed_at":"2020-01-09T03:41:04.000Z","size":48,"stargazers_count":62,"open_issues_count":5,"forks_count":35,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-09-18T10:47:04.395Z","etag":null,"topics":["python","session","tornado"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MitchellChu.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-30T00:47:26.000Z","updated_at":"2023-12-17T09:31:01.000Z","dependencies_parsed_at":"2022-08-28T09:12:47.062Z","dependency_job_id":null,"html_url":"https://github.com/MitchellChu/torndsession","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchellChu%2Ftorndsession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchellChu%2Ftorndsession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchellChu%2Ftorndsession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchellChu%2Ftorndsession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MitchellChu","download_url":"https://codeload.github.com/MitchellChu/torndsession/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225869904,"owners_count":17537169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","session","tornado"],"created_at":"2024-11-23T15:17:09.904Z","updated_at":"2024-11-23T15:17:10.350Z","avatar_url":"https://github.com/MitchellChu.png","language":"Python","readme":"Torndsession Session\n====================\n\n\n`Torndsession \u003chttps://github.com/MitchellChu/torndsession\u003e`_ is a session extension for `Tornado \u003chttps://github.com/tornadoweb/tornado\u003e`__ web framework.\nTorndsession support application memory, file, redis or memcached to save session data for request, and it's easy to extend for developer.\n\nQuick links\n===========\n    \n* `Documentation \u003chttp://blog.useasp.net/category/30.aspx\u003e`_\n  \n* `Source (github) \u003chttps://github.com/MitchellChu/torndsession\u003e`_\n  \n* `Torndsession License \u003chttps://raw.githubusercontent.com/MitchellChu/torndsession/master/LICENSE\u003e`_\n  \n* `Examples \u003chttps://github.com/MitchellChu/torndsession/tree/master/demos\u003e`_\n\n\nHello, Session\n==============\n\nHere is a simple \"Hello, Session\" example web app for Tornado with Torndsession.::\n\n\n    import tornado.web\n    import tornado.httpserver\n    import tornado.ioloop\n    import torndsession\n\n\n    class Application(tornado.web.Application):\n        def __init__(self):\n            handlers = [\n                (r\"/\", MainHandler),\n            ]\n            settings = dict(\n                debug=True,\n            )\n            # sid_name, lifetime added in 1.1.5.0\n            # sid_name: the name of session id in cookies.\n            # lifetime: session default expires seconds.\n            session_settings = dict(\n                driver='memory',\n                driver_settings={'host': self},\n                force_persistence=True,\n                sid_name='torndsessionID',\n                session_lifetime=1800\n            ),\n            settings.update(session=session_settings)\n            tornado.web.Application.__init__(self, handlers, **settings)\n\n\n    class MainHandler(torndsession.sessionhandler.SessionBaseHandler):\n        def get(self):\n            self.write(\"Hello, Session.\u003cbr/\u003e\")\n            if 'data' in self.session:\n                data = self.session['data']\n            else:\n                data = 0\n            self.write('data=%s' % data)\n            self.session[\"data\"] = data + 1\n\n\n    def main():\n        http_server = tornado.httpserver.HTTPServer(Application())\n        http_server.listen(8000)\n        tornado.ioloop.IOLoop.instance().start()\n\n\n    if __name__ == \"__main__\":\n        main()\n\n\nIn this example, Request handler obtain memory session feature, it just inherit from SessionBaseHandler. more session example see `torndsession demos \u003chttps://github.com/MitchellChu/torndsession/tree/master/demos\u003e`_.\n\n\nInstallation\n============\n\n**Automatic installation**:\n\n::\n\n    pip install torndsession\n\nTorndsession is listed in `PyPI \u003chttps://pypi.python.org/pypi/torndsession\u003e`__ and can be installed with `pip` or `easy_install`. Note that this installation can not install demos applicatinos which be included in source code.\n\nThe another way is use `git+` install torndsession from github.\n\n::\n\n    pip install git+https://github.com/mitchellchu/torndsession\n\n\n\n**Manual installation**:\n\nIn this way, you need download the source from `PyPI \u003chttps://pypi.python.org/pypi/torndsession\u003e`__.::\n\n    tar xvzf torndsession.tar.gz\n    cd torndsession\n    python setup.py build\n    sudo python setup.py install\n\n\nThe Torndsession source code is hosted on `GitHub \u003chttps://github.com/MitchellChu/torndsession\u003e`_.\n\n\nUpdated\n=======\n\nTorndsession 1.1.5:\n\n- fixed bug in 1.1.4\n- default session id value generator changed. see `#ISSUE 12# \u003chttps://github.com/MitchellChu/torndsession/issues/12\u003e`_.\n- added two custom key in settings.\n\n  - sid_name: session's cookie name.\n  - session_lifetime: default expired seconds for session.\n\nTorndsession 1.1.4:\n\n- fixed bug\n\nTorndsession 1.1.3 fixed some bug and supported python 3.x.\n\n\nRequires\n========\n\n\n+ `Tornado \u003chttps://github.com/tornadoweb/tornado\u003e`__\n+ `Redis (Optional) \u003chttp://redis.io/\u003e`_\n+ `Memcached (Optional) \u003chttp://memcached.org/\u003e`_\n\n\n\nLICENSE\n=======\nTorndsession is licensed under MIT.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellchu%2Ftorndsession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellchu%2Ftorndsession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellchu%2Ftorndsession/lists"}