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'.
Additional context
The problem seems to be here:
|
message = await response.json(content_type = None) |
|
message_is_dict = True |
Aiohttp response.json returns None if the response body is empty and then the library sets message_is_dict incorrectly to True.
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.getOrganizationNetworkswith a non-existing organization id.Expected behavior
The library should return
APIErrorbut it crashes instead an returnsAttributeError: 'NoneType' object has no attribute 'keys'.Additional context
The problem seems to be here:
dashboard-api-python/meraki/aio/rest_session.py
Lines 242 to 243 in 7dd5f57
Aiohttp
response.jsonreturnsNoneif the response body is empty and then the library setsmessage_is_dictincorrectly toTrue.