[Gelöst]:OPSI 4.0.6 rpc API
Verfasst: 05 Okt 2015, 18:01
Hallo,
folgendes Code Snippet gibt unter 4.0.6 keine Antwort mehr zurück:
Wenn ich es im interaktiven Modus über Interface abfrage bekomme ich eine Antwort. Über /rpc kommt einfach keine Antwort zurück.
Wenn ich ohne authorization Anfrage kommt zumindest die Antwort, dass ich nicht authentifiziert bin.
folgendes Code Snippet gibt unter 4.0.6 keine Antwort mehr zurück:
Code: Alles auswählen
import httplib
import json
import base64
import ssl
def getMacAddress(FQDN):
pc = FQDN
payload = {"method": "getMacAddress", "params": [pc], "id": 1, }
auth = "Basic " + base64.encodestring('user:password').strip()
headers = {'content-type': 'application/json', 'Authorization': auth}
conn = httplib.HTTPSConnection('opsi', 4447,context=ssl._create_unverified_context())
conn.request("POST", "/rpc", json.dumps(payload), headers)
response = conn.getresponse()
print(response.read())
#data = json.loads(response.read())
conn.close()
#print(data)
print('finish')
getMacAddress(FQDN)
Wenn ich ohne authorization Anfrage kommt zumindest die Antwort, dass ich nicht authentifiziert bin.