Arduino IoT Cloud API Python Client for managing devices, things, properties, and timeseries data
npx @tessl/cli install tessl/pypi-arduino-iot-client@3.0.0A comprehensive Python client library for the Arduino IoT Cloud API, enabling developers to programmatically manage Arduino IoT devices, things, properties, and timeseries data. The library provides a complete set of API endpoints for device management, thing management, property handling, dashboard operations, and LoRa device support with OAuth2 authentication.
pip install arduino-iot-clientimport iot_api_client as iot
from iot_api_client.configuration import Configuration
from iot_api_client.api import DevicesV2Api, ThingsV2Api, PropertiesV2Api
from iot_api_client.models import *
from iot_api_client.exceptions import ApiExceptionimport iot_api_client as iot
from iot_api_client.configuration import Configuration
from iot_api_client.api import DevicesV2Api
from iot_api_client.exceptions import ApiException
# Configure OAuth2 authentication
client_config = Configuration(host="https://api2.arduino.cc")
client_config.access_token = "YOUR_ACCESS_TOKEN"
# Create API client
client = iot.ApiClient(client_config)
# Initialize device API
devices_api = DevicesV2Api(client)
try:
# List all devices
devices = devices_api.devices_v2_list()
for device in devices:
print(f"{device.name} - id: {device.id} - type: {device.type}")
except ApiException as e:
print(f"API Error: {e}")For organization access, specify organization ID:
# At client level
client = iot.ApiClient(client_config, header_name="X-Organization", header_value="org_id")
# Or at method level
devices = devices_api.devices_v2_list(x_organization="org_id")The Arduino IoT Client follows a resource-based API structure:
The library is auto-generated from OpenAPI specifications, ensuring consistency with the Arduino IoT Cloud API.
Complete lifecycle management of Arduino IoT devices including creation, configuration, certificate management, OTA updates, and password handling.
class DevicesV2Api:
def devices_v2_create(self, create_devices_v2_payload, x_organization=None) -> ArduinoDevicev2: ...
def devices_v2_list(self, across_user_ids=None, serial=None, tags=None, x_organization=None) -> List[ArduinoDevicev2]: ...
def devices_v2_show(self, id, x_organization=None) -> ArduinoDevicev2: ...
def devices_v2_update(self, id, devicev2, x_organization=None) -> ArduinoDevicev2: ...
def devices_v2_delete(self, id, x_organization=None) -> None: ...Management of IoT things including creation, cloning, sketch generation, and template operations.
class ThingsV2Api:
def things_v2_create(self, thing_create, force=None, x_organization=None) -> ArduinoThing: ...
def things_v2_list(self, across_user_ids=None, device_id=None, ids=None, tags=None, x_organization=None) -> List[ArduinoThing]: ...
def things_v2_clone(self, id, thing_clone, x_organization=None) -> ArduinoThing: ...
def things_v2_create_sketch(self, id, thing_sketch=None, x_organization=None) -> ArduinoThing: ...
def things_v2_delete(self, id, x_organization=None) -> None: ...Real-time and historical property data management with timeseries support and property type discovery.
class PropertiesV2Api:
def properties_v2_create(self, id, model_property, x_organization=None) -> ArduinoProperty: ...
def properties_v2_list(self, id, show_deleted=None, x_organization=None) -> List[ArduinoProperty]: ...
def properties_v2_publish(self, id, pid, property_value, x_organization=None) -> None: ...
def properties_v2_timeseries(self, id, pid, desc=None, start=None, end=None, interval=None, x_organization=None) -> ArduinoSeriesResponse: ...
def properties_v2_update(self, id, pid, model_property, x_organization=None) -> ArduinoProperty: ...
class PropertyTypesV1Api:
def property_types_v1_list_types(self) -> List[ArduinoPropertytype]: ...Dashboard creation, sharing, widget linking, and template management.
class DashboardsV2Api:
def dashboards_v2_create(self, dashboardv2, x_organization=None) -> ArduinoDashboardv2: ...
def dashboards_v2_list(self, x_organization=None) -> List[ArduinoDashboardv2]: ...
def dashboards_v2_clone(self, dashboard_id, x_organization=None) -> ArduinoDashboardv2: ...
def dashboards_v2_share(self, id, sharerequest, x_organization=None) -> None: ...
def dashboards_v2_link(self, id, widget_id, widgetlink, x_organization=None) -> None: ...Advanced querying capabilities for timeseries data with batch operations and historical data access.
class SeriesV2Api:
def series_v2_batch_query_raw(self, batch_query_raw_requests_media_v1, x_organization=None) -> ArduinoSeriesRawResponse: ...
def series_v2_batch_query_sampling(self, batch_query_sampled_requests_media_v1, x_organization=None) -> ArduinoSeriesSampledResponse: ...
def series_v2_batch_query_raw_last_value(self, batch_last_value_requests_media_v1, x_organization=None) -> ArduinoSeriesRawLastValueResponse: ...
def series_v2_historic_data(self, historic_data_request, x_organization=None) -> ArduinoSeriesResponse: ...LoRa device management and frequency plan configuration for long-range IoT applications.
class LoraDevicesV1Api:
def lora_devices_v1_create(self, create_lora_devices_v1_payload, x_organization=None) -> ArduinoLoradevicev1: ...
def lora_devices_v1_list(self, x_organization=None) -> List[ArduinoLoradevicev1]: ...
def lora_devices_v1_show(self, id, x_organization=None) -> ArduinoLoradevicev1: ...
class LoraFreqPlanV1Api:
def lora_freq_plan_v1_list(self, x_organization=None) -> List[ArduinoLorafreqplanv1]: ...OAuth2 authentication with Arduino IoT Cloud API:
class Configuration:
def __init__(self, host="https://api2.arduino.cc", access_token=None, **kwargs): ...
# Properties
host: str
access_token: str
api_key: Dict[str, str]
username: str
password: str
client_side_validation: boolComprehensive exception hierarchy for robust error handling:
class ApiException(Exception): ...
class BadRequestException(ApiException): ... # HTTP 400
class UnauthorizedException(ApiException): ... # HTTP 401
class ForbiddenException(ApiException): ... # HTTP 403
class NotFoundException(ApiException): ... # HTTP 404
class ServiceException(ApiException): ... # HTTP 5xxclass ApiClient:
def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None): ...
class ApiResponse:
status_code: int
headers: Dict[str, str]
data: Any
raw_data: bytes