Tencent Cloud SDK for Python (International Edition)

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

Official SDK for accessing Tencent Cloud services from Python, designed for international regions. Version 3.1.91 provides async support, auto-retry, and typed APIs. Released via PyPI with monthly updates.

pip install tencentcloud-sdk-python-intl-en
error ImportError: cannot import name 'CvmClient' from 'tencentcloud.cvm.v20170312'
cause Wrong import path; the client is named `cvm_client`.
fix
Use from tencentcloud.cvm.v20170312 import cvm_client then instantiate cvm_client.CvmClient().
error tencentcloud.common.exception.TencentCloudSDKException: [TencentCloudSDKException] code: UnsupportedOperation, message: this action not support this region
cause Region not available for the requested API or using wrong endpoint (e.g., Chinese mainland endpoint for international account).
fix
Verify region and endpoint. For international, use *.tencentcloudapi.com and check region list.
error AttributeError: module 'tencentcloud' has no attribute 'cvm'
cause Forgot to install the SDK; installed wrong package (mainland version).
fix
Install tencentcloud-sdk-python-intl-en using pip.
breaking In v3, all service modules have been restructured. Code from v2 (e.g., `from tencentcloud.cvm.v20170312 import cvm_client`) will fail if you use old import paths.
fix Update imports to match v3 structure: `from tencentcloud.cvm.v20170312 import cvm_client, models`.
breaking Async client moved to separate package `tencentcloud-sdk-python-intl-en-asyncio`. If you use async, install that and import from `tencentcloud.asyncio`.
fix Install `tencentcloud-sdk-python-intl-en-asyncio` and change imports to `from tencentcloud.cvm.v20170312 import cvm_client as cvm_client_async` from the asyncio module.
gotcha Many users mistakenly use the Chinese mainland SDK (`tencentcloud-sdk-python`) instead of the international SDK (`tencentcloud-sdk-python-intl-en`), causing endpoint mismatches.
fix Ensure you install `tencentcloud-sdk-python-intl-en` and set endpoints to `*.tencentcloudapi.com` instead of `*.api.qcloud.com`.
deprecated The `Credential` class from `tencentcloud.common.credential` is deprecated in favor of `tencentcloud.common.credential.Credential` (same class, but future-proof).
fix Use `from tencentcloud.common import credential` and then `credential.Credential(...)`.

Initialize a CVM client and describe instances.

import os
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.cvm.v20170312 import cvm_client, models

cred = credential.Credential(
    os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
    os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
httpProfile = HttpProfile()
httpProfile.endpoint = "cvm.tencentcloudapi.com"
clientProfile = ClientProfile()
clientProfile.httpProfile = httpProfile
client = cvm_client.CvmClient(cred, "ap-guangzhou", clientProfile)
req = models.DescribeInstancesRequest()
resp = client.DescribeInstances(req)
print(resp.to_json_string())