Tencent Cloud DTS SDK for Python
raw JSON → 3.1.88 verified Sat May 09 auth: no python
Tencent Cloud DTS (Data Transmission Service) SDK for Python, part of the official tencentcloud-sdk-python ecosystem. Version 3.1.88 provides APIs to manage data migration, sync, and subscription tasks. The SDK follows a monthly release cadence aligned with the main tencentcloud-sdk-python package.
pip install tencentcloud-sdk-python-dts Common errors
error ModuleNotFoundError: No module named 'tencentcloud.dts' ↓
cause The package 'tencentcloud-sdk-python-dts' is not installed or the import path is wrong.
fix
Install using 'pip install tencentcloud-sdk-python-dts' and ensure import path is 'from tencentcloud.dts.v20180330 import ...'
error AttributeError: module 'tencentcloud.dts' has no attribute 'v20180330' ↓
cause Incorrect import; the top-level 'dts' module does not contain the versioned submodule directly.
fix
Use 'from tencentcloud.dts.v20180330 import dts_client' after ensuring the SDK is installed.
error TencentCloudSDKException: [InvalidParameter] The parameter 'JobId' is not supported ↓
cause Using an outdated API model that doesn't match the actual API schema.
fix
Update the SDK to the latest version and use the models from the correct versioned subpackage.
Warnings
breaking API version path changed: Prior to 2022, the SDK used 'v20180330' as the API version. Older code may have used 'v20211206' or other versions; verify the correct version for your region. ↓
fix Use 'v20180330' for current DTS APIs. Check Tencent Cloud documentation for the exact version.
gotcha Models and client must be imported from the versioned subpackage. Importing from 'tencentcloud.dts' directly will raise ModuleNotFoundError. ↓
fix Always use: from tencentcloud.dts.v20180330 import dts_client, models
deprecated Old credential initialization using SecretId/SecretKey strings directly is deprecated in favor of Credential() object. ↓
fix Use credential.Credential(secret_id='...', secret_key='...') instead of passing raw strings.
Imports
- DtsClient wrong
from tencentcloud.dts import DtsClientcorrectfrom tencentcloud.dts.v20180330 import dts_client - CreateMigrateJobRequest wrong
from tencentcloud.dts import modelscorrectfrom tencentcloud.dts.v20180330 import models
Quickstart
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.dts.v20180330 import dts_client, models
try:
cred = credential.Credential(
secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = dts_client.DtsClient(cred, 'ap-guangzhou')
req = models.DescribeMigrateJobsRequest()
resp = client.DescribeMigrateJobs(req)
print(resp.to_json_string())
except TencentCloudSDKException as e:
print(e)