Help

0

External API's

Avatar
Ali Ammar

I have a Python file that contains code from an external API

When executed, it produces the following error



C:\Users\PC\Documents>python -m web_service.py

Traceback (most recent call last):

File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 185, in _run_module_as_main

mod_name, mod_spec, code = _get_module_details(mod_name, _Error)

File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 111, in _get_module_details

__import__(pkg_name)

File "C:\Users\PC\Documents\web_service.py", line 8, in

ver = common.version()

File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\xmlrpc\client.py", line 1109, in __call__

return self.__send(self.__name, args)

File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\xmlrpc\client.py", line 1450, in __request

response = self.__transport.request(

File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\xmlrpc\client.py", line 1153, in request

return self.single_request(host, handler, request_body, verbose)

File "C:\Users\PC\AppData\Local\Programs\Python\Python38\lib\xmlrpc\client.py", line 1183, in single_request
raise ProtocolError(

xmlrpc.client.ProtocolError:
ProtocolError for localhost:8069//xmlrpc/2/common: 404 NOT FOUND

this is the code :

importxmlrpc.client
url = 'http://localhost:8069/'
db = 'arados'
username = 'admin'
password = 'admin'
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
ver = common.version()
print('details *********', ver)


any help ??
Avatar
Discard
1Answer
3
Best Answer

Hi Ali,

Please try by removing "/" added at the end of the url variable,

Try this: url = 'http://localhost:8069'


For more details refer this video:Odoo External API


Thank you

1Comment
Avatar
Discard
Avatar
Ali Ammar
-

Thank you very much it's working