Sorry if I appear to be spamming:
There is an updated get_device_statuses function (which is in my current meraki.py library) at the base of this post
Personally I think the ability to evaluate the HTTP status codes would enhance the 'official' library a lot.
Testing with my own scripts shows
Normal calls behave normally so should I forget to update a function call it won't break 😉
So the following two calls will return the regular value and work 'normally'
myStatuses = meraki.get_device_statuses(my_key, my_org)
myStatuses = meraki.get_device_statuses(my_key, my_org, True)
The modified version call returns the regular value to the first specified variable and the HTTP status code to the second variable
myStatuses, httpRetcode = get_device_statuses(my_key, my_org, True, True)
I hope it helps some folks and personally I think it would be a nice addition to the 'official' library.
# List the status of every Meraki device in the organization
def get_device_statuses(api_key, org_id, suppress_print=False):
__hasorgaccess(api_key, org_id)
call_type = 'Device Statuses'
get_url = '{0}/organizations/{1}/deviceStatuses'.format(str(base_url), str(org_id))
headers = {
'x-cisco-meraki-api-key': format(str(api_key)),
'Content-Type': 'application/json'
}
dashboard = requests.get(get_url, headers=headers)
#
# Call return handler function to parse Dashboard response
#
result = __returnhandler(dashboard.status_code, dashboard.text, call_type, suppress_print)
return result