semvec/pypi-packages huggingface dataset:
BeakerShowSessions 0.1.3
A Beaker extension to show the active sessions
License: MIT
Keywords: beaker session database active

BeakerShowSessions
==================

BeakerShowSessions is a Beaker_ extension that shows the active sessions
according to the given WSGI configuration file. Currently the plugin only works
with ext:database session storage backend.

You can find the Mercurial repository at bitbucket.org_

Installation
------------

easy_install::

    $ <env>/bin/easy_install BeakerCleanup

pip::

    $ <env>/bin/pip install BeakerCleanup

Upgrading from a previous version
---------------------------------

Note that in 0.1.3 the location of the session functions changed from
``beaker.scripts:get/show_sessions`` to
``beaker.scripts.sessions:get/show_sessions`` due to namespace issues.

Usage
-----

You can call get_sessions in order to get a list of active sessions (dicts)::

    >>> from beaker.scripts.sessions import get_sessions
    >>> get_sessions('cfg/production.ini')

BeakerShowSessions expects to find these keys in the `[app:main]` section of
your configuration file

    - ``beaker.session.type = ext:database`` - the only supported backend (yet)
    - ``beaker.session.url`` - an `SQLAlchemy engine URL`_
    - ``beaker.session.timeout`` - session timeout in seconds
    - ``beaker.session.table_name`` - (optional) session storage table. Defaults
      to `beaker_cache`.

If your beaker configuration directive prefix is not `beaker.session` (or you
have multiple beaker instances) you can provide the correct prefix as a second
option::

    >>> get_sessions('cfg/prod.ini', 'bkr.sess')

If you are going to use BeakerShowSessions separately you could choose to call
`show_sessions` instead. It takes the same parameters but returns a pretty ASCII
table with results, like this::


    >>> print show_sessions('cfg/prod.ini')
    --------------------------------------------------------
         _accessed_time |      _creation_time |    user_name
    --------------------------------------------------------
    2001-02-03 10:11:12 | 2001-02-03 10:11:12 | john@doe.com

PasteCall_ provides a convenient method to call `show_sessions` from the
console::

    $ paster call beaker.scripts.sessions:show_sessions 'cfg/prod.ini' 'bkr.ses'
    --------------------------------------------------------
         _accessed_time |      _creation_time |    user_name
    --------------------------------------------------------
    2001-02-03 10:11:12 | 2001-02-03 10:11:12 | john@doe.com

.. _Beaker: http://beaker.groovie.org
.. _SQLAlchemy engine URL: http://www.sqlalchemy.org/docs/05/dbengine.html#create-engine-url-arguments
.. _PasteCall: http://pypi.python.org/pypi/PasteCall
.. _bitbucket.org: http://bitbucket.org/kaukas/beakershowsessions
BeakerCleanup 0.1.2
A beaker plugin that implements a function to be called from the command line via PasteCall.
License: MIT
Keywords: beaker session database cleanup sqlalchemy delete old

Beaker Session Cleanup
======================

This is a beaker plugin which exposes a cleanup function. The cleanup function
cleans the old session data created by beaker database backend.

It uses a PasterCall plugin to expose the cleanup to the console.

Mercurial repository: bitbucket.org_.

.. _bitbucket.org: http://bitbucket.org/kaukas/beakercleanup

Installation
------------

easy_install::

    $ <env>/bin/easy_install BeakerCleanup

pip::

    $ <env>/bin/pip install BeakerCleanup

Upgrading from a previous version
---------------------------------

Note that in 0.1.2 the location of the cleanup function changed from
``beaker.scripts:cleanup`` to ``beaker.scripts.cleanup:cleanup`` due to
namespace issues.

General usage
-------------

    ``$ <environment>/bin/paster call beaker.scripts.cleanup:cleanup path/to/config.cfg 4h bkr.session``

    ``beaker.scripts.cleanup:cleanup`` is an entry point to the cleanup function

    ``path/to/config.cfg`` is a path to the WSGI config file containing beaker
    session parameters (usually .cfg or .ini)

    ``4h`` tells to clean up sessions which are older than (has ``accessed``
    before) 4 hours. You can give

        - 1m, 18m, 76m, etc - minutes
        - 1h, 4h, 25h, etc - hours
        - 1d, 2d, 32d, etc - days

    ``bkr.session`` (optional, default: ``'beaker.session'``) is a prefix which
    is needed to find the beaker session parameters in the config file. It
    allows you to choose which backend to clean up when you have more than one.
    E.g.::

        bkr.session.url = sqlite:///my.db
        bkr.session.table_name = sessions
        
Usage examples
--------------

If you are mostly using defaults your call could be similar to this:

    ``$ paster call beaker.scripts.cleanup:cleanup my/config.ini 5h``

If you are using a virtual environment <env> you'll call it like this

    ``$ <env>/bin/paster call beaker.scripts.cleanup:cleanup <env>/prod.ini 3d``