Iot_api_client - AttributeError: module 'iot_api_client' has no attribute 'DevicesV2Api'

Hi,
I am trying to list the properties of a Thing using the Python API, but I'm having a bit of trouble.
I took this code from here: https://pypi.org/project/arduino-iot-client/

    ......
    ......
    # Now we setup the iot-api Python client, first of all create a
    # configuration object. The access token goes in the config object.
    client_config = iot_api_client.Configuration(host = "https://api2.arduino.cc/iot")
    # client_config.debug = True
    client_config.access_token = token.get("access_token")

    # Create the iot-api Python client with the given configuration
    api_client = iot_api_client.ApiClient(client_config)

    # Each API model has its own wrapper, here we want to interact with
    # devices, so we create a DevicesV2Api object
    api_instance = iot_api_client.DevicesV2Api(api_client)

    # Get a list of devices, catching the specific exception
    try:
        resp = api_instance.devices_v2_list()
        print("Response from server:")
        print(resp)

    except ApiException as e:
        print("An exception occurred: {}".format(e))

And when I run it I get the following error:
AttributeError: module 'iot_api_client' has no attribute 'DevicesV2Api'.

Thanks!

Solved :slight_smile:
I downgraded to version 1.4.4 (pip install arduino-iot-client==1.4.4)

1 Like

Hello,
Has anyone managed to run the program without downgrading to version 1.4.4?

Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.