odoorpc.session¶
This module contains some helper functions used to save and load sessions in OdooRPC.
-
odoorpc.session.
get
(name, rc_file='~/.odoorpcrc')¶ Return the session configuration identified by name from the rc_file file.
>>> import odoorpc >>> from pprint import pprint as pp >>> pp(odoorpc.session.get('foo')) {'database': 'db_name', 'host': 'localhost', 'passwd': 'password', 'port': 8069, 'protocol': 'jsonrpc', 'timeout': 120, 'type': 'ODOO', 'user': 'admin'}
Raise: ValueError (wrong session name)
-
odoorpc.session.
get_all
(rc_file='~/.odoorpcrc')¶ Return all session configurations from the rc_file file.
>>> import odoorpc >>> from pprint import pprint as pp >>> pp(odoorpc.session.get_all()) {'foo': {'database': 'db_name', 'host': 'localhost', 'passwd': 'password', 'port': 8069, 'protocol': 'jsonrpc', 'timeout': 120, 'type': 'ODOO', 'user': 'admin'}, ...}
-
odoorpc.session.
remove
(name, rc_file='~/.odoorpcrc')¶ Remove the session configuration identified by name from the rc_file file.
>>> import odoorpc >>> odoorpc.session.remove('foo')
Raise: ValueError (wrong session name)
-
odoorpc.session.
save
(name, data, rc_file='~/.odoorpcrc')¶ Save the data session configuration under the name name in the rc_file file.
>>> import odoorpc >>> odoorpc.session.save( ... 'foo', ... {'type': 'ODOO', 'host': 'localhost', 'protocol': 'jsonrpc', ... 'port': 8069, 'timeout': 120, 'database': 'db_name' ... 'user': 'admin', 'passwd': 'password'})