{"id":28342,"library":"tencentcloud-sdk-python-kms","title":"Tencent Cloud KMS SDK for Python","description":"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.","status":"active","version":"3.1.86","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencent","kms","cloud","sdk","encryption"],"install":[{"cmd":"pip install tencentcloud-sdk-python-kms","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Runtime dependency for authentication and base client","package":"tencentcloud-sdk-python-common","optional":false}],"imports":[{"note":"Common mistake: importing KmsClient directly from the submodule instead of using the package alias","wrong":"from tencentcloud.kms.v20190118.kms_client import KmsClient","symbol":"KmsClient","correct":"from tencentcloud.kms.v20190118 import kms_client"},{"note":"","wrong":"","symbol":"models","correct":"from tencentcloud.kms.v20190118 import models"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\nfrom tencentcloud.kms.v20190118 import kms_client, models\n\nsecret_id = os.environ.get('TENCENTCLOUD_SECRET_ID', '')\nsecret_key = os.environ.get('TENCENTCLOUD_SECRET_KEY', '')\nif not secret_id or not secret_key:\n    raise ValueError('Missing credentials')\n\ncred = credential.Credential(secret_id, secret_key)\nclient = kms_client.KmsClient(cred, 'ap-guangzhou')\n\nreq = models.DescribeKeysRequest()\ntry:\n    resp = client.DescribeKeys(req)\n    print(resp.to_json_string())\nexcept TencentCloudSDKException as e:\n    print(e)","lang":"python","description":"Initialize KMS client and list keys (requires credentials via environment variables)."},"warnings":[{"fix":"Always pass a valid region string to KmsClient constructor.","message":"Region parameter must be set when creating client; if omitted, defaults to empty string and may cause errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'kms_client.KmsClient' as shown in quickstart.","message":"The kms_client module is generated and the class name is KmsClient with capital C, but users often write 'kmsclient'.","severity":"gotcha","affected_versions":"3.x"},{"fix":"Install tencentcloud-sdk-python-kms and import from tencentcloud.kms.","message":"Old import path tencentcloud-sdk-python without -kms suffix is deprecated in favor of product-specific packages.","severity":"deprecated","affected_versions":"< 3.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"pip install tencentcloud-sdk-python-kms (installs common automatically)","cause":"Missing tencentcloud-sdk-python-common runtime dependency.","error":"ModuleNotFoundError: No module named 'tencentcloud'"},{"fix":"Use a valid region like 'ap-guangzhou', 'ap-beijing', etc.","cause":"Region passed to client is invalid or not supported by KMS.","error":"tencentcloud.common.exception.TencentCloudSDKException: UnsupportedRegion"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}