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 Common errors
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.
Warnings
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(...)
Imports
- IotClient wrong
from tencentcloud_sdk_python_iot import ...correctfrom tencentcloud.iot.v20180123 import iot_client - models wrong
from tencentcloud.iot import modelscorrectfrom tencentcloud.iot.v20180123 import models
Quickstart
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())