I am using zeep for the first time in Python3, to access XML data from N-central Solarwind and trying to get customer information but I am stuck on Settings parameter I am getting TypeError got an unexpected keyword argument 'Key' I have tried everything but it is giving me the same error, even tried with get_type() method but still getting same error
from zeep import Client
from zeep import xsd
def customer_info(request):
client = Client('http://server-name/dms/services/ServerEI?wsdl')
# settings_type=client.get_type('ns0:Customer')
# value = settings_type(Key='listSOs', Value='true')
value={
'Key': 'listSOs',
'Value': "true",
}
response =client.service.Customer_List(Username=USER,Password=PASS,Settings=value)
response2 =client.service.Device_List(Username=USER,Password=PASS,Settings=xsd.SkipValue)
return HttpResponse(response)
This is written in its Docs
Parameters:
username - the MSP N-central username.
password - the corresponding MSP N-central password.
settings - A list of non default settings stored in a List of EiKeyValue objects. Below is a list of the acceptable Keys and Values. If not used leave null.
(Key) listSOs - (Value) "true" or "false". If true only SOs with be shown, if false only customers and sites will be shown. Default value is false.
The format was wrong following code worked for me
from zeep import Client
from zeep import xsd
def customer_info(request):
client = Client('http://server-name/dms/services/ServerEI?wsdl')
value = [
{
'Key': 'listSOs',
'Value': 'false'
}
]
response =client.service.Customer_List(Username=USER,Password=PASS,Settings=value)
return HttpResponse(response)