Last active
February 17, 2020 06:30
-
-
Save sehrishnaz/ee6b780d49cc5748cfe606896edef3ea to your computer and use it in GitHub Desktop.
Connecting to odoo using XML-RPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read more in detail: http://learnopenerp.blogspot.com/2019/10/connecting-to-odoo-using-xml-rpc.html