Skip to content

getOrganizationWirelessSsidsStatusesByDevice KeyError #270

@sloweclair

Description

@sloweclair

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 python library is trying to read pageEndAt when it isn't there in a response

Python version installed
3.12.4

Meraki library version installed
1.51.0

Have you reproduced the issue with the latest version of this library? And with the latest version of Python?
Yes

OS Platform
Windows 11

Describe the bug
The getOrganizationWirelessSsidsStatusesByDevice crashes when there is more than 1 page. It is trying to read pageEndAt from the response.json() but it isn't there.

Traceback (most recent call last):
  File "meraki-bug-check\crash.py", line 5, in <module>
    data = dashboard.wireless.getOrganizationWirelessSsidsStatusesByDevice(<redacted>, total_pages=-1, networkIds=['<redacted>'], perPage=500)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "meraki-bug-check\.venv\Lib\site-packages\meraki\api\wireless.py", line 3018, in getOrganizationWirelessSsidsStatusesByDevice
    return self._session.get_pages(metadata, resource, params, total_pages, direction)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "meraki-bug-check\.venv\Lib\site-packages\meraki\rest_session.py", line 457, in _get_pages_legacy
    end = response.json()['pageEndAt']
          ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'pageEndAt'

How can we replicate the problem you're reporting?
Run the code snippet below. It will crash as long as it is requesting more than 1 page

Expected behavior
Not crash

Code snippets

import meraki
dashboard = meraki.DashboardAPI()
data = dashboard.wireless.getOrganizationWirelessSsidsStatusesByDevice(<redacted>, total_pages=-1, networkIds=['<redacted>'], perPage=100)
print(data)

Metadata

Metadata

Assignees

Labels

bugbug with the library itself, not with the API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions