I am trying to retrieve my devices performance with the python api call
result = devices_controller.get_network_device_performance(collect)
For some reason when I populate the collect dictionary and call this api I get the error:
raise APIException('HTTP response not OK.', context) meraki.exceptions.api_exception.APIException: HTTP response not OK.
But when I convert the dictionary (collect) to a string I get no error, but also no performance data
What could be causing this error and what other approaches could I use to try and get the performance data from the network devices.
Many Thanks!
They need to be JSON.
Could you please expand on this?
The code is from meraki: here
The code works for a section of devices and networks but then stops and throws the error in my original question
I've worked through this example with the Python SDK and can't reproduce your error. It might help if we could see the HTTP response that is considered invalid - that should give us some more clues. Can you catch the exception and display the context? I'm not sure what format the context takes, I'd try all these:
try: result = devices_controller.get_network_device_performance(collect) catch APIException as e: print(e) print(e.context) print(e['context'])
I can't tell if the error is related to the content you're sending, or in parsing the response.
I've been doing this to send dicts using the requests module:
payload = { "roomId": roomId, "personId": personId } resp = requests.post(..., payload = payload)
I've been doing this to convert my HTTP responses into Python-native dicts:
response = requests.get(url, headers=headers) #This is a string type(response.text) import json res = json.loads(response.text) #This is now a dict type(res)