Monday, November 19, 2018

How to use xmlrpc using Python older version


Integration with Odoo using XMLRPC Older Version.




#Step1 Add library
import xmlrpclib

#Step2 Add Variables
url="http://YourIP/DomainName:PortNumber"
db = "v2"
username = "admin"
password = "admin"

#Call to server
common = xmlrpclib.ServerProxy("{}/xmlrpc/common".format(url), allow_none=True)
uid = common.login(db, username, password)
common = xmlrpclib.ServerProxy("{}/xmlrpc/object".format(url), allow_none=True)

#Call specific API
print common.execute(db, uid, password, "Model.Name", "Model.Method.Name", "YourPayload", "ContextIncaseNeedToPass")


Add xmlrpc library in case didn't install in your server click here to download and install.

No comments:

Post a Comment

If you have any query please comment here, Will get back to you :)