Saturday 1 August 2015

XML-RPC Example

Hi All,
    Here am explaining how to use xml-rpc.

    Ex:suppose we need to create a partner


import xmlrpclib
username = 'admin' #the user
pwd = '******'      #the password of the user
dbname = 'db123'    #the database

# Get the uid
sock_common = xmlrpclib.ServerProxy ('http://localhost:1212/xmlrpc/common')
uid = sock_common.login(dbname, username, pwd)

#replace localhost with the address of the server
sock = xmlrpclib.ServerProxy('http://localhost:1212/xmlrpc/object')


values = {
    'name':"Partner1",

    
    }

sock.execute(dbname, uid, pwd, 'res.partner', 'create', values)

No comments:

Post a Comment