コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
12179 ビュー

please help for External API, i am following guide lines from here:

https://www.odoo.com/documentation/14.0/webservices/odoo.html

wrote the .py file as below:

url = "127.0.0.1:8069"
db = 'odb14'
username = 'admin'
password = 'admin'
import xmlrpc.client
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
version = common.version()
print("details....", version)

when run it returns OSError: unsupported XML-RPC protocol ( my OS is Ubuntu 18.05 )

odoo@ubuntu:~/odoo-dev/odoo$ python3.6 -m odoo_webservice
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/odoo/odoo-dev/odoo/odoo_webservice.py", line 8, in <module>
    common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1418, in __init__
    raise OSError("unsupported XML-RPC protocol")
OSError: unsupported XML-RPC protocol

アバター
破棄
著作者 最善の回答

solved, the code below works fine, thanks to Daniel Ries author of Odoo Development Cookbook 

url = 'http://localhost:8069'
db = 'odb14'
username = 'admin'
password = 'admin'
import xmlrpc.client

common = xmlrpc.client.ServerProxy('%s/xmlrpc/2/common' % url)
version = common.version()
print("details...", version)
アバター
破棄
関連投稿 返信 ビュー 活動
0
8月 21
2703
1
5月 22
2852
1
1月 23
1727
0
9月 21
2040
0
7月 21
4826