Registry /
aws / tencentcloud-sdk-python
Install & Compatibility
Where this runs
tested against v3.1.97 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.960 runs
installs and imports cleanly · install 0.0s · import 0.669s · 73.9MB
glibcpy 3.10–3.960 runs
installs and imports cleanly · install 14.5s · import 0.601s · 287MB
200MB installed
● package 200MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Credential
✓ from tencentcloud.common import credential
TencentCloudSDKException
✓ from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
CvmClient, models
✓ from tencentcloud.cvm.v20170312 import cvm_client, models
Product-specific imports will vary by service and API version (e.g., `cvm.v20170312`).
This quickstart demonstrates how to initialize the client with credentials, create a request object for the CVM `DescribeInstances` API, and execute the call. Ensure `TENCENTCLOUD_SECRET_ID` and `TENCENTCLOUD_SECRET_KEY` environment variables are set for authentication.
import os
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cvm.v20170312 import cvm_client, models
try:
# Get credentials from environment variables (recommended for security)
secret_id = os.environ.get('TENCENTCLOUD_SECRET_ID', 'YOUR_SECRET_ID')
secret_key = os.environ.get('TENCENTCLOUD_SECRET_KEY', 'YOUR_SECRET_KEY')
# Check if credentials are placeholders
if secret_id == 'YOUR_SECRET_ID' or secret_key == 'YOUR_SECRET_KEY':
print("Please set TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY environment variables.")
exit(1)
cred = credential.Credential(secret_id, secret_key)
# Instantiate the client object for a specific product (e.g., CVM)
# The second parameter is the region, e.g., 'ap-shanghai' or 'ap-guangzhou'
client = cvm_client.CvmClient(cred, "ap-shanghai")
# Instantiate a request object for the API (e.g., DescribeInstancesRequest)
req = models.DescribeInstancesRequest()
# Call the API method through the client object
resp = client.DescribeInstances(req)
# Print the returned response in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(f"An error occurred: {err}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
Debug
Known issues
gotchaOn macOS, Python 3.6+ users may encounter SSL certificate verification errors. This is due to Python no longer using system certificates. You typically need to run `/Applications/Python 3.6/Install Certificates.command` (adjust path for your Python version) to install `certifi`'s certificates.fixRun the `Install Certificates.command` script found within your Python installation directory on macOS.
affects: Python 3.6+
gotchaDo not mix the full SDK package (`tencentcloud-sdk-python`) with individual product packages (e.g., `tencentcloud-sdk-python-cvm`) in the same environment. This can lead to conflicts and unexpected behavior.fixChoose either the full SDK or specific product SDKs for installation, but not both simultaneously in one environment.
affects: All versions
gotchaIf operating behind a proxy, you must explicitly set the `https_proxy` system environment variable, otherwise, connection timeout exceptions may occur.fixSet the `https_proxy` environment variable (e.g., `export https_proxy="http://your_proxy_ip:port"`).
affects: All versions
breakingThe default language of the SDK has been changed to `en-US` in recent versions. If your application relies on localized responses, this change might affect the output of SDK calls.fixExplicitly set the language parameter in your client profile or request if you require a different language for responses.
affects: v3.0.x onwards (after specific update, exact version not specified but noted as 'latest')
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tencentcloud'
The 'tencentcloud-sdk-python' library or its core components have not been installed in the current Python environment.
fixpip install tencentcloud-sdk-python
AuthFailure.SignatureFailure: The provided credentials could not be validated because of an invalid signature.
The SecretId, SecretKey, or region provided are incorrect, or your system's clock is out of sync, leading to an invalid request signature.
fixReview your SecretId and SecretKey for accuracy, ensure the region specified in the client initialization matches your API key's region, and verify your system time synchronization.
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(...) timed out.
The client failed to establish a connection to the Tencent Cloud API endpoint within the allotted time, likely due to network issues, firewall restrictions, or an unresponsive server.
fixIncrease the request timeout in your ClientProfile's HttpProfile and verify network connectivity to Tencent Cloud API endpoints. Example: `httpProfile.reqTimeout = 60`.
InvalidParameter.InvalidParameterValue: The parameter value 'xxx' is invalid for parameter 'yyy'.
One of the request parameters supplied to the Tencent Cloud API is invalid, not within the allowed range, or does not conform to the required format as specified by the API documentation.
fixConsult the official Tencent Cloud API documentation for the specific service and action to ensure all request parameters and their values adhere to the required specifications.
Upgrade
Version history
3.1.114latest on PyPI · released Jun 11, 2026
Audit
Dependencies
No dependency data recorded yet.