oerplib.tools.session (New in version 0.8)

This module contains some helper functions used to save and load sessions in OERPLib.

oerplib.tools.session.get(name, rc_file='~/.oerplibrc')

Return the session configuration identified by name from the rc_file file.

>>> import oerplib
>>> oerplib.tools.session.get('foo')
{'protocol': 'xmlrpc', 'user': 'admin', 'timeout': 120, 'database': 'db_name', 'passwd': 'admin', 'type': 'OERP', 'port': 8069, 'server': 'localhost'}
Raise:oerplib.error.Error
oerplib.tools.session.get_all(rc_file='~/.oerplibrc')

Return all session configurations from the rc_file file.

>>> import oerplib
>>> oerplib.tools.session.get_all()
{'foo': {'protocol': 'xmlrpc', 'user': 'admin', 'timeout': 120, 'database': 'db_name', 'passwd': 'admin', 'type': 'OERP', 'port': 8069, 'server': 'localhost'}}
oerplib.tools.session.remove(name, rc_file='~/.oerplibrc')

Remove the session configuration identified by name from the rc_file file.

>>> import oerplib
>>> oerplib.tools.session.remove('foo')
Raise:oerplib.error.Error
oerplib.tools.session.save(name, data, rc_file='~/.oerplibrc')

Save the data session configuration under the name name in the rc_file file.

>>> import oerplib
>>> oerplib.tools.session.save('foo', {'type': 'OERP', 'server': 'localhost', 'protocol': 'xmlrpc', 'port': 8069, 'timeout': 120, 'user': 'admin', 'passwd': 'admin', 'database': 'db_name'})

Previous topic

oerplib.tools

Next topic

oerplib.error

This Page