AttributeError 'dict' object has no attribute 'extend'
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. The error is thrown from the library itself. Meraki API has returned 200. I do not have access to the actual response body for this case (does not happen for all cases), but the library should be able to handle this case and there seems to be a clear bug with the code.
Python version installed 3.12.7
Meraki library version installed 2.0.3
Have you reproduced the issue with the latest version of this library? And with the latest version of Python? This error was reported to our monitoring tool from an end user using our application. I do not have API access to the organization in question and it does not seem to happen with any organization I have access to.
OS Platform Linux
Describe the bug
The problematic code is in _get_pages_legacy -method
https://github.com/meraki/dashboard-api-python/blob/a026860357c997689c79295c9cac6040cbc13808/meraki/aio/rest_session.py#L470
The code in context:
elif isinstance(results, dict) and "items" in results:
json_response = await response.json(content_type=None)
results.extend(json_response["items"])
Looking at the code, it seems that first there is a check that results is a dict followed by trying to extend it. Since extend is available only for lists, an error is thrown. Perhaps the intention was to extend results["items"]?
How can we replicate the problem you're reporting? Since this happened to our end customer (and reported to our monitoring tool), I do not have an API access to the case when this happened. I'm failing to replicate this error with the organizations I have access to. But looking at the code snippet above, the bug seems fairly obvious.
Edit: after some additional digging, this seems to happen with paginated responses when there are multiple pages
Expected behavior The library should not throw an error but extend the results correctly.
Code snippets Added in the description
@TKIPisalegacycipher is it possible to get this looked at? This affects multiple API operations with pagination
Hi @timoturkki with #310 a new version of the library was released. Please try again once it hits PyPI and let us know.