Describe how you confirmed the issue is with the library, and not with the API itself, or a server-side issue of some other kind.
Error originates from the library.
Python version installed
Python 3.10
Meraki library version installed
1.38.0
Have you reproduced the issue with the latest version of this library? And with the latest version of Python?
I can reproduce the error with the latest library version.
Describe the bug
When Dashboard API returns 404 status (or any other status) with no body, the library doesn't handle the response well and crashes with AttributeError: 'NoneType' object has no attribute 'keys'.
How can we replicate the problem you're reporting?
Call AsyncDashboardAPI.organizations.getOrganizationNetworks with a non-existing organization id.
Expected behavior
The library should return APIError but it crashes instead an returns AttributeError: 'NoneType' object has no attribute 'keys'.
@ollipa thanks for reporting this. The fix is merged and will be included in a future release of the library. Feel free to rebase on this current main branch if you like.
Describe how you confirmed the issue is with the library, and not with the API itself, or a server-side issue of some other kind. Error originates from the library.
Python version installed Python 3.10
Meraki library version installed 1.38.0
Have you reproduced the issue with the latest version of this library? And with the latest version of Python? I can reproduce the error with the latest library version.
Describe the bug When Dashboard API returns 404 status (or any other status) with no body, the library doesn't handle the response well and crashes with
AttributeError: 'NoneType' object has no attribute 'keys'
.How can we replicate the problem you're reporting? Call
AsyncDashboardAPI.organizations.getOrganizationNetworks
with a non-existing organization id.Expected behavior The library should return
APIError
but it crashes instead an returnsAttributeError: 'NoneType' object has no attribute 'keys'
.Additional context The problem seems to be here: https://github.com/meraki/dashboard-api-python/blob/7dd5f57c80636e1e0a04c48c32a88c840fc0a337/meraki/aio/rest_session.py#L242-L243
Aiohttp
response.json
returnsNone
if the response body is empty and then the library setsmessage_is_dict
incorrectly toTrue
.