Registry / aws / tencentcloud-sdk-python

tencentcloud-sdk-python

JSON →
library3.1.114pypypi✓ verified 84d ago

Tencent Cloud SDK for Python is the official software development kit for interacting with Tencent Cloud services. It provides a unified, Pythonic interface to TencentCloud API 3.0, enabling developers to easily integrate various cloud products like CVM, VPC, and CBS into their applications. The SDK supports Python 3.6 and above, offering consistent API usage, error codes, and response formats across different services. It is actively maintained with frequent updates to support new services and features.

pip install tencentcloud-sdk-python
INSTALL
IMPORT
SIG · TENCENTCLOUD-SDK-P
T
tencentcloud-sdk-python
awspythonv3.1.114
Install
14.5s avg
Import
635ms
Disk
200MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.960 runs
installs and imports cleanly · install 0.0s · import 0.669s · 73.9MB
glibc
py 3.103.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.
fix
Run 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.
fix
Choose 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.
fix
Set 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.
fix
Explicitly 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.
fix
pip 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.
fix
Review 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.
fix
Increase 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.
fix
Consult 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.

Agent activity
61 hits · last 30 days
node
56
Resources