Save your credentials (session)¶

Once you are authenticated with your ODOO instance, you can save your credentials under a code name and use this one to quickly instantiate a new ODOO class:

>>> import odoorpc
>>> odoo = odoorpc.ODOO('localhost')
>>> user = odoo.login('tutorial', 'admin', 'admin')

By default, these informations are stored in the ~/.odoorpcrc file. You can however use another file:

>>>'tutorial', '~/my_own_odoorpcrc')

Then, use the odoorpc.ODOO.load() class method:

>>> import odoorpc
>>> odoo = odoorpc.ODOO.load('tutorial')

Or, if you have saved your configuration in another file:

>>> odoo = odoorpc.ODOO.load('tutorial', '~/my_own_odoorpcrc')

You can check available sessions with odoorpc.ODOO.list(), and remove them with odoorpc.ODOO.remove():

>>> odoorpc.ODOO.list()
>>> odoorpc.ODOO.remove('tutorial')
>>> 'tutorial' not in odoorpc.ODOO.list()