Tencent Cloud IoT Python SDK

raw JSON →
3.0.1459 verified Sat May 09 auth: no python

Provides Python access to Tencent Cloud IoT services (IoT Hub, IoT Explorer). Current version 3.0.1459. Released at the same cadence as TencentCloud SDK core (weekly).

pip install tencentcloud-sdk-python-iot
error ModuleNotFoundError: No module named 'tencentcloud'
cause Missing common SDK package.
fix
Install both: pip install tencentcloud-sdk-python-common tencentcloud-sdk-python-iot
error AttributeError: module 'tencentcloud.iot' has no attribute 'v20180123'
cause Using an incorrect API version string or the package is not installed.
fix
Verify API version from docs and install the correct package.
error tencentcloud.common.exception.TencentCloudSDKException: [TencentCloudSDKException] code: UnsupportedOperation
cause Using an endpoint that does not exist for the IoT service in the current region.
fix
Check region availability for IoT service.
gotcha Import paths include the API version (e.g., v20180123). Using an incorrect or outdated version will cause AttributeErrors.
fix Check the official documentation for the correct API version string.
gotcha The package tencentcloud-sdk-python-iot does NOT include the common SDK; you must also install tencentcloud-sdk-python-common.
fix Run: pip install tencentcloud-sdk-python-common
deprecated Old imports using camelCase module names (e.g., IotClient) are deprecated in favor of snake_case (iot_client).
fix Use snake_case import: from tencentcloud.iot.v20180123 import iot_client
breaking In SDK v3+, the credential class moved to tencentcloud.common.credential (was tencentcloud.common).
fix Use 'from tencentcloud.common import credential' then credential.Credential(...)

List IoT products using credentials from environment variables.

import os
from tencentcloud.common import credential
from tencentcloud.iot.v20180123 import iot_client, models

secret_id = os.environ.get('TENCENTCLOUD_SECRET_ID', '')
secret_key = os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
cred = credential.Credential(secret_id, secret_key)
client = iot_client.IotClient(cred, 'ap-guangzhou')
req = models.DescribeProductsRequest()
resp = client.DescribeProducts(req)
print(resp.to_json_string())