Skip to content

Instantly share code, notes, and snippets.

@sehrishnaz
Last active February 17, 2020 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sehrishnaz/ee6b780d49cc5748cfe606896edef3ea to your computer and use it in GitHub Desktop.
Save sehrishnaz/ee6b780d49cc5748cfe606896edef3ea to your computer and use it in GitHub Desktop.
Connecting to odoo using XML-RPC
import xmlrpclib
from openerp.exceptions import except_orm
url = "http://localhost:8009"
db = "your_db_name"
user = "abc@gmail.com"
pwd = "1234"
url = 'http://localhost:8069' or ''
try:
common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url), allow_none=1)
uid = common.authenticate(db, user, pwd, {})
if uid == 0:
raise Exception('Credentials are wrong for remote system access')
else:
message = 'Connection Stablished Successfully'
except Exception as e:
raise except_orm(_('Remote system access Issue \n '), _(e))
print('******message*****',message)
return uid, url, db, common, pwd
@sehrishnaz
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment