Source code for odoo_xmlrpc_twisted.functions.test_odoo_connection
"""Test the connection to Odoo Server."""# call the function "get_settings_odoo" to get the parameters# for the logging of the model on the "odoo Webservice API"try:from.get_settings_odooimportget_settings_odooexceptImportError:fromget_settings_odooimportget_settings_odooresult=get_settings_odoo()db=result[0]username=result[2]password=result[3]models=result[4]common_endpoint=result[5]
[docs]deftest_odoo_connection():""" Tests if the connection to the odoo system works. The function gives back the result of the testing. """try:# used to refer to the common endpoint of the Odoo XML-RPC API common=common_endpoint# test if a connection to the Odoo Server worksuserid=common.authenticate(db,username,password,{})# returns a userid if successful ifuserid!=False:result='True'else:result='False'except:result='False'return(result)