I'm writing a script using async io, and I keep getting this intermittent error when calling dashboard.wireless.getNetworkWirelessSsid():
File "C:\Users\pid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\meraki\aio\rest_session.py", line 261, in _request
action_batch_concurrency_error = {'errors': [
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'message_is_dict' where it is not associated with a value
I've traced it back to this chunk of code in the Python asyncio library:
https://github.com/meraki/dashboard-api-python/blob/main/meraki/aio/rest_session.py#L247
It tries to set message_is_dict inside an exception handler:
The problem is that goes out of scope as soon as the try handler is finished, so when the following code tries to use that variable, it no longer exists.
https://github.com/meraki/dashboard-api-python/blob/main/meraki/aio/rest_session.py#L265
In my particular case, I temporarily hard-coded message_is_dict to true, and then I correctly got this error:
wireless, getNetworkWirelessSsid > https://api.meraki.com/api/v1/networks/N_xxx/wireless/ssids/3 - 400 Bad Request, {'errors': ['This endpoint only supports wireless networks']}
Meraki API error: wireless, getNetworkWirelessSsid - 400 Bad Request, {'errors': ['This endpoint only supports wireless networks']}