Registry / aws / tencentcloud-sdk-python-common

tencentcloud-sdk-python-common

JSON →
library3.1.117pypypi✓ verified 84d ago

The `tencentcloud-sdk-python-common` library provides the foundational components for interacting with Tencent Cloud services in Python. It includes core utilities for authentication, client profiles, and base models, serving as a crucial dependency for service-specific SDK modules like `tencentcloud-sdk-python-cvm`. It is part of the larger `tencentcloud-sdk-python` project, currently at version 3.1.79, with frequent updates to support new services and features.

pip install tencentcloud-sdk-python-common
INSTALL
IMPORT
SIG · TENCENTCLOUD-SDK-P
T
tencentcloud-sdk-python-common
awspythonv3.1.117
Install
10.1s avg
Import
628ms
Disk
430MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.117 · 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.920 runs
installs and imports cleanly · install 0.0s · import 0.657s · 351.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 10.1s · import 0.599s · 423MB
430MB installed
● package 430MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Credential
from tencentcloud.common.credential import Credential
ClientProfile
from tencentcloud.common.profile.client_profile import ClientProfile
HttpProfile
from tencentcloud.common.profile.http_profile import HttpProfile
AbstractModel
from tencentcloud.common.abstract_model import AbstractModel
TencentCloudSDKException
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException

This quickstart demonstrates how to use the common components (`Credential`, `ClientProfile`, `HttpProfile`) to initialize a service client (e.g., `CvmClient`) and make a basic API call. Ensure your `TENCENTCLOUD_SECRET_ID` and `TENCENTCLOUD_SECRET_KEY` environment variables are set.

import os from tencentcloud.common.credential import Credential from tencentcloud.common.profile.client_profile import ClientProfile from tencentcloud.common.profile.http_profile import HttpProfile from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException from tencentcloud.cvm.v20170312.client import CvmClient from tencentcloud.cvm.v20170312.models import DescribeInstancesRequest try: # Set credentials via environment variables for security secret_id = os.environ.get("TENCENTCLOUD_SECRET_ID", "") secret_key = os.environ.get("TENCENTCLOUD_SECRET_KEY", "") region = "ap-guangzhou" # Replace with your desired region cred = Credential(secret_id, secret_key) http_profile = HttpProfile() # Specify the endpoint for the service if needed, otherwise it's auto-resolved http_profile.endpoint = "cvm.tencentcloudapi.com" client_profile = ClientProfile() client_profile.httpProfile = http_profile # Initialize a service client (e.g., CVMClient) using common components client = CvmClient(cred, region, client_profile) # Create a request object for a specific API operation req = DescribeInstancesRequest() # For a basic test, no specific filters are applied, listing all instances # Call the API and print the response resp = client.DescribeInstances(req) print(resp.to_json_string()) except TencentCloudSDKException as err: print(f"An error occurred: {err}") print(f"Error Code: {err.get_code()}") print(f"Request ID: {err.get_request_id()}")
Debug
Known issues
gotchaThe Tencent Cloud Python SDK has undergone a major rewrite. Ensure you are using the modern `tencentcloud-sdk-python` package family (v3+), not the deprecated `qcloud_sdk_python`.
fix
Install `tencentcloud-sdk-python` or service-specific packages like `tencentcloud-sdk-python-cvm`. Update import statements from `QcloudApi` or similar to `tencentcloud.common.*` and `tencentcloud.service.version.client.*`. Consult the official migration guide.
affects: All versions of `tencentcloud-sdk-python-common` (v3.x.x)
gotchaThe SDK is modular. If you only install `tencentcloud-sdk-python-common`, you will not have access to service-specific clients (e.g., `CvmClient`) for API calls.
fix
For specific services, install their respective packages (e.g., `pip install tencentcloud-sdk-python-cvm`) or install the monolithic `pip install tencentcloud-sdk-python` which includes all services and common modules.
affects: All v3.x.x
gotchaCredential handling is critical. Incorrectly providing `SecretId` and `SecretKey` or omitting them is a common source of authentication failures.
fix
Provide credentials securely via environment variables (`TENCENTCLOUD_SECRET_ID`, `TENCENTCLOUD_SECRET_KEY`), or directly when initializing the `Credential` object. Avoid hardcoding sensitive credentials in source code.
affects: All v3.x.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tencentcloud.cvm'
The service-specific package (e.g., CVM) was not installed, or only `tencentcloud-sdk-python-common` was installed without the specific service module.
fix
Install the full SDK (`pip install tencentcloud-sdk-python`) or the specific service package (`pip install tencentcloud-sdk-python-cvm`).
TencentCloudSDKException: Code=AuthFailure.SecretIdNotFound
The Tencent Cloud SecretId or SecretKey were not provided, are incorrect, or the environment variables are not loaded.
fix
Ensure `TENCENTCLOUD_SECRET_ID` and `TENCENTCLOUD_SECRET_KEY` environment variables are set correctly, or pass them directly when initializing `Credential(secret_id, secret_key)`.
TypeError: 'module' object is not callable (e.g., client = CvmClient)
Attempting to use a class (like `CvmClient` or `DescribeInstancesRequest`) as if it were a function without instantiating it.
fix
Ensure you instantiate classes using parentheses, e.g., `client = CvmClient(cred, region, client_profile)` and `req = DescribeInstancesRequest()`.
ModuleNotFoundError: No module named 'QcloudApi'
Attempting to use code from the legacy and deprecated `qcloud_sdk_python` package with the modern SDK.
fix
Migrate your code to use the `tencentcloud-sdk-python` library. Update imports and client initialization patterns to match the current SDK documentation.
Upgrade
Version history
3.1.117latest on PyPI · released Jun 16, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Resources
tencentcloud-sdk-python-common — pip install tencentcloud-sdk-python-common · libregistry