obsession


Nameobsession JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://hg.sr.ht/~olly/obsession/
SummaryServer-side HTTP sessions
upload_time2023-05-25 12:36:32
maintainer
docs_urlNone
authorOliver Cope
requires_python
licenseApache
keywords wsgi session sessions management cookie
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Obsession
=========

Fast WSGI sessions. Zero dependencies. Python 3 ready.

Basic usage::

    import obsession

    application = obsession.SessionMiddleware(application)


Advanced usage::

    # Customize all the options
    application = obsession.SessionMiddleware(
        application,
        id_persister=obsession.CookieIdPersistence(cookie_name='mysession',
                                                   max_age=86400,
                                                   path='/my-site',
                                                   domain='mysite.example.org'
                                                   secure=True),
        backend=obsession.FileBackend(directory='/tmp/session-store',
                                      prefix='session_')
    )


Your application will now have a session object available in
``environ['ob.session']``.

The session object acts like a regular dictionary::

    session = environ['ob.session']
    session['foo'] = 'bar'
    session['bar'] = [1, 2, 3]

The session will be saved automatically whenever you mutate the
session object itself - for example by assigning a new key, or reassigning an
existing key. However if you change an already stored value then
you should call ``session.save()`` to ensure your changes are saved.

There are some useful extra properties and methods::

    # Persist the session to the backend
    session.save()

    # What's my session id?
    my_session_id = session.id

    # Cycle the session id.
    # This generates a new session id and invalidates the old one.
    session.cycle()

    # Load a session with a known id.
    # Useful if you need to pass the session through another service that
    # does not have access to the cookie.
    s = environ['ob.session']
    s.load_id('my_session_id')

    # Delete the session.
    # This removes all data from the backend storage and deletes the client's
    # session cookie
    session.delete()

            

Raw data

            {
    "_id": null,
    "home_page": "https://hg.sr.ht/~olly/obsession/",
    "name": "obsession",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "wsgi session sessions management cookie",
    "author": "Oliver Cope",
    "author_email": "oliver@redgecko.org",
    "download_url": "https://files.pythonhosted.org/packages/b7/fc/cbab7f4b48e5bd5f7890571d5ce47ac5418141317d24ddede4e46186b8f5/obsession-1.2.1.tar.gz",
    "platform": null,
    "description": "Obsession\n=========\n\nFast WSGI sessions. Zero dependencies. Python 3 ready.\n\nBasic usage::\n\n    import obsession\n\n    application = obsession.SessionMiddleware(application)\n\n\nAdvanced usage::\n\n    # Customize all the options\n    application = obsession.SessionMiddleware(\n        application,\n        id_persister=obsession.CookieIdPersistence(cookie_name='mysession',\n                                                   max_age=86400,\n                                                   path='/my-site',\n                                                   domain='mysite.example.org'\n                                                   secure=True),\n        backend=obsession.FileBackend(directory='/tmp/session-store',\n                                      prefix='session_')\n    )\n\n\nYour application will now have a session object available in\n``environ['ob.session']``.\n\nThe session object acts like a regular dictionary::\n\n    session = environ['ob.session']\n    session['foo'] = 'bar'\n    session['bar'] = [1, 2, 3]\n\nThe session will be saved automatically whenever you mutate the\nsession object itself - for example by assigning a new key, or reassigning an\nexisting key. However if you change an already stored value then\nyou should call ``session.save()`` to ensure your changes are saved.\n\nThere are some useful extra properties and methods::\n\n    # Persist the session to the backend\n    session.save()\n\n    # What's my session id?\n    my_session_id = session.id\n\n    # Cycle the session id.\n    # This generates a new session id and invalidates the old one.\n    session.cycle()\n\n    # Load a session with a known id.\n    # Useful if you need to pass the session through another service that\n    # does not have access to the cookie.\n    s = environ['ob.session']\n    s.load_id('my_session_id')\n\n    # Delete the session.\n    # This removes all data from the backend storage and deletes the client's\n    # session cookie\n    session.delete()\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "Server-side HTTP sessions",
    "version": "1.2.1",
    "project_urls": {
        "Homepage": "https://hg.sr.ht/~olly/obsession/"
    },
    "split_keywords": [
        "wsgi",
        "session",
        "sessions",
        "management",
        "cookie"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9e0f85bd23a146a83da71794a394b54c7e9d36d810a354c4173864e60c78481c",
                "md5": "37c9bdef763e92f614427a895ce88873",
                "sha256": "aee146659cee6e569f71d28dfc316e01e94a180f819910af95972c722699375a"
            },
            "downloads": -1,
            "filename": "obsession-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "37c9bdef763e92f614427a895ce88873",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10025,
            "upload_time": "2023-05-25T12:36:30",
            "upload_time_iso_8601": "2023-05-25T12:36:30.393578Z",
            "url": "https://files.pythonhosted.org/packages/9e/0f/85bd23a146a83da71794a394b54c7e9d36d810a354c4173864e60c78481c/obsession-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7fccbab7f4b48e5bd5f7890571d5ce47ac5418141317d24ddede4e46186b8f5",
                "md5": "e1554a42cc97b9d9ae64d87876ecee79",
                "sha256": "d70428794ef195be6f22db673b2c6df895d4be11e4d98106d4855b039b64907b"
            },
            "downloads": -1,
            "filename": "obsession-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e1554a42cc97b9d9ae64d87876ecee79",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12978,
            "upload_time": "2023-05-25T12:36:32",
            "upload_time_iso_8601": "2023-05-25T12:36:32.225719Z",
            "url": "https://files.pythonhosted.org/packages/b7/fc/cbab7f4b48e5bd5f7890571d5ce47ac5418141317d24ddede4e46186b8f5/obsession-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-25 12:36:32",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "obsession"
}
        
Elapsed time: 0.06768s