import requests headers = { 'Content-Type': 'application/json', } url = 'http://10.40.1.225:80' data = '{"command":"status","params":["ver"]}' username = 'demo' passwd = 'demo123' #GET# command = '/Elvaco-Rest/rest/system/time' response = requests.get(url + command, auth=(username, passwd)) print("GET") print(response.text) #POST# command = '/Elvaco-Rest/rest/console/command' response = requests.post(url + command, headers=headers, data=data, auth=(username, passwd)) print("POST") print(response.text) #JSON# data = '{"jsonrpc": "2.0","method": "pdb.browse", "id": 3}' command = '/Elvaco-JSON-RPC/PDB' response = requests.post(url + command, headers=headers, data=data, auth=(username, passwd)) print("POST JSON") print(response.text)