Registry /
aws / tencentcloud-sdk-python-tmt
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TmtClient
✓ from tencentcloud.tmt.v20180321 import tmt_client, models
✗ from tencentcloud.tmt import TmtClient
Version v20180321 is the only API version; omitting it causes ImportError.
TextTranslateRequest
✓ from tencentcloud.tmt.v20180321 import models
✗ from tencentcloud.tmt import models
models subpackage is version-specific.
Translate 'Hello' from English to Chinese.
import os
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.tmt.v20180321 import tmt_client, models
try:
cred = credential.Credential(
secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = tmt_client.TmtClient(cred, 'ap-guangzhou')
req = models.TextTranslateRequest()
req.Source = 'en'
req.Target = 'zh'
req.SourceText = 'Hello'
req.ProjectId = 0
resp = client.TextTranslate(req)
print(resp.TargetText)
except TencentCloudSDKException as e:
print(e)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tencentcloud'
The common base package (tencentcloud-sdk-python-common) is not installed or missing.
fixInstall the common SDK: pip install tencentcloud-sdk-python-common
AttributeError: module 'tencentcloud.tmt' has no attribute 'TmtClient'
Wrong import path without the version subpackage.
fixUse 'from tencentcloud.tmt.v20180321 import tmt_client' instead.
TencentCloudSDKException: [InvalidParameter] invalid request parameter
ProjectId missing or set to an invalid value.
fixSet req.ProjectId = 0 (or a valid project ID) in the request.
TencentCloudSDKException: [AuthFailure] SecretId not found
Credentials not provided or incorrect.
fixCheck that TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY are set correctly.
Upgrade
Version history
3.1.70latest on PyPI · released Apr 2, 2026
Audit
Dependencies
tencentcloud-sdk-python-commonrequiredAll service SDKs depend on the common package for credential and HTTP handling.