Registry / auth-security / tencentcloud-sdk-python-kms

tencentcloud-sdk-python-kms

JSON →
library3.1.86pypypi✓ verified 88d ago

Official Tencent Cloud SDK for the Key Management Service (KMS), providing APIs to create, manage, and use encryption keys. Current version: 3.1.86. Released monthly.

pip install tencentcloud-sdk-python-kms
INSTALL
IMPORT
SIG · TENCENTCLOUD-SDK-P
T
tencentcloud-sdk-python-kms
auth-securitypythonv3.1.86
harness data pending
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.

KmsClient
✓ from tencentcloud.kms.v20190118 import kms_client
✗ from tencentcloud.kms.v20190118.kms_client import KmsClient
Common mistake: importing KmsClient directly from the submodule instead of using the package alias
models
✓ from tencentcloud.kms.v20190118 import models

Initialize KMS client and list keys (requires credentials via environment variables).

import os from tencentcloud.common import credential from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException from tencentcloud.kms.v20190118 import kms_client, models secret_id = os.environ.get('TENCENTCLOUD_SECRET_ID', '') secret_key = os.environ.get('TENCENTCLOUD_SECRET_KEY', '') if not secret_id or not secret_key: raise ValueError('Missing credentials') cred = credential.Credential(secret_id, secret_key) client = kms_client.KmsClient(cred, 'ap-guangzhou') req = models.DescribeKeysRequest() try: resp = client.DescribeKeys(req) print(resp.to_json_string()) except TencentCloudSDKException as e: print(e)
Debug
Known issues
gotchaRegion parameter must be set when creating client; if omitted, defaults to empty string and may cause errors.
fix
Always pass a valid region string to KmsClient constructor.
affects: all
gotchaThe kms_client module is generated and the class name is KmsClient with capital C, but users often write 'kmsclient'.
fix
Use 'kms_client.KmsClient' as shown in quickstart.
affects: 3.x
deprecatedOld import path tencentcloud-sdk-python without -kms suffix is deprecated in favor of product-specific packages.
fix
Install tencentcloud-sdk-python-kms and import from tencentcloud.kms.
affects: < 3.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tencentcloud'
Missing tencentcloud-sdk-python-common runtime dependency.
fix
pip install tencentcloud-sdk-python-kms (installs common automatically)
tencentcloud.common.exception.TencentCloudSDKException: UnsupportedRegion
Region passed to client is invalid or not supported by KMS.
fix
Use a valid region like 'ap-guangzhou', 'ap-beijing', etc.
Upgrade
Version history
3.1.86latest on PyPI · released Apr 26, 2026
Audit
Dependencies
tencentcloud-sdk-python-commonrequiredRuntime dependency for authentication and base client
Agent activity
40 hits · last 30 days
node
38
OpenAI (training)
1
Resources