Skip to content

device_inventory.py - KeyError looking at response #50

@mrzepa

Description

@mrzepa

When trying to use the inventory.add_devices, it raises a KeyError:

result = inventory.add_devices(ac, all_devices)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/pycentral/classic/device_inventory.py", line 252, in add_devices
Message - {resp["msg"]["detail"]}')
~~~~~~~~~~~^^^^^^^^^^
KeyError: 'detail'

--
My code:
from pycentral.base import ArubaCentralBase
from pycentral.device_inventory import Inventory

ac = ArubaCentralBase(central_info=central_info)
inventory = Inventory()
all_devices = switch_devices + wifi_devices
result = inventory.add_devices(ac, all_devices)

I have upgraded to the latest pycentral package of 2.0.0a2 and still get this issue.

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