在odoo中使用rpc创建产品时候发现链接出了错 试了半小时 (当时严重怀疑自己的智商…)先上代码
from xmlrpc import client
server_url = 'http://localhost:8888'
db_name = 'haha'
username = 'XXXXX@qq.com'
password = '123456'
common = client.ServerProxy('%s/xmlrpc/2/common' % server_url)
user_id = common.authenticate(db_name, username, password, {})
if user_id:
print("Success: User id is", user_id)
else:
print("Failed: wrong credentials")
在连接时候username使用的数据库的登录名 哎 其实它是odoo的在登陆时候账号和密码 db_name 当初创建 数据的库的名字 odoo 右上角 登录人旁边有 …
成功链接时候eg: Success: User id is XX