Skip to content

aio/rest_session.py crashing on 400 errors with a UnboundLocalError #223

Description

@dpnetca

Issue with SDK version 1.36.0 when, I am calling the createOrganizationAdmin, expecting back a 400 bad request error, but script is crashing with below trace. reverting to SDK version 1.34.0 and error is handled properly.

...
add_result = await dashboard.organizations.createOrganizationAdmin(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxxxxxxx/py/momapy_cli/.venv/lib/python3.11/site-packages/meraki/aio/rest_session.py", line 512, in post
async with await self.request(metadata, "POST", url, json=json) as response:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxxxxxxxxx/py/momapy_cli/.venv/lib/python3.11/site-packages/meraki/aio/rest_session.py", line 137, in request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
File "/home/xxxxxxxxxxx/py/momapy_cli/.venv/lib/python3.11/site-packages/meraki/aio/rest_session.py", line 275, in _request
message_is_dict

Specifically testing API call in postman and the response back I am getting is:
{
"errors": [
"Email xxxxxxxx@abcdefg.com is already registered with a Cisco Meraki Dashboard account. For security purposes, that user must verify their email address before administrator permissions can be granted here."
]
}

Python version installed
3.11.4

Meraki library version installed
1.36.0 (works properly in 1.34.0 and earlier))

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

OS Platform
Linux

How can we replicate the problem you're reporting?
Add user to 1 org that does not currently exist, then add user to a second org before they validate and create account, should get back a 400 bad request error as described

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions