There's more...

Like XML-RPC, the version method is also available in the JSON-RPC. This version method comes under the common service and is accessible publicly. You can get version information without login information. See the following example showing how to fetch the version info of the Odoo server:

import json
import random
import requests


server_url = 'http://localhost:8069'
json_endpoint = "%s/jsonrpc" % server_url
headers = {"Content-Type": "application/json"}

def get_json_payload(service, method, *args):
... # see full function definition in last section

payload = get_json_payload("common", "version")
response = requests.post(json_endpoint, data=payload, headers=headers)

print(response.json())

This program will display the following output:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset