the
the

Reputation: 21939

How to find name of database for XML-RPC connection to OpenERP/Odoo?

I'm trying to use an XMLRPC connection to Odoo/OpenERP but I don't know which database to connect to. I can log in to the system through the web interface, but I don't know where it would show me which db it is using. How can I find out?

import xmlrpclib

user = 'admin'
password = 'PASSWORD'
host = 'localhost:8069'
db = 'test'  # How do I find out what database to connect to?

sock = xmlrpclib.ServerProxy('http://%s/xmlrpc/common' % host)
uid = sock.login(db, user, password)

Upvotes: 3

Views: 3386

Answers (2)

the
the

Reputation: 21939

Here's how to fetch it over XML-RPC in Python:

db_serv_url = 'http://{}/xmlrpc/db'.format(host)
sock = xmlrpclib.ServerProxy(db_serv_url)
dbs = sock.list()
print dbs

Note the endpoint is /db and not /common.

Upvotes: 5

user1120753
user1120753

Reputation: 639

If you only need the know the database name, you could click on the 'manage databases' on the login screen. Click on the backup option from the left-side menu. There you can see the databases that are available to openerp

Upvotes: 2

Related Questions