{"id":6468,"library":"tencentcloud-sdk-python","title":"Tencent Cloud SDK for Python","description":"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.","status":"active","version":"3.1.78","language":"en","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["cloud","tencent cloud","sdk","api client"],"install":[{"cmd":"pip install tencentcloud-sdk-python","lang":"bash","label":"Standard Installation"},{"cmd":"pip install --upgrade tencentcloud-sdk-python-common tencentcloud-sdk-python-cvm","lang":"bash","label":"Install specific product SDKs (e.g., CVM)"},{"cmd":"pip install -i https://mirrors.tencent.com/pypi/simple/ --upgrade tencentcloud-sdk-python","lang":"bash","label":"Chinese mainland mirror source"}],"dependencies":[],"imports":[{"symbol":"Credential","correct":"from tencentcloud.common import credential"},{"symbol":"TencentCloudSDKException","correct":"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException"},{"note":"Product-specific imports will vary by service and API version (e.g., `cvm.v20170312`).","symbol":"CvmClient, models","correct":"from tencentcloud.cvm.v20170312 import cvm_client, models"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\nfrom tencentcloud.cvm.v20170312 import cvm_client, models\n\ntry:\n    # Get credentials from environment variables (recommended for security)\n    secret_id = os.environ.get('TENCENTCLOUD_SECRET_ID', 'YOUR_SECRET_ID')\n    secret_key = os.environ.get('TENCENTCLOUD_SECRET_KEY', 'YOUR_SECRET_KEY')\n\n    # Check if credentials are placeholders\n    if secret_id == 'YOUR_SECRET_ID' or secret_key == 'YOUR_SECRET_KEY':\n        print(\"Please set TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY environment variables.\")\n        exit(1)\n\n    cred = credential.Credential(secret_id, secret_key)\n\n    # Instantiate the client object for a specific product (e.g., CVM)\n    # The second parameter is the region, e.g., 'ap-shanghai' or 'ap-guangzhou'\n    client = cvm_client.CvmClient(cred, \"ap-shanghai\")\n\n    # Instantiate a request object for the API (e.g., DescribeInstancesRequest)\n    req = models.DescribeInstancesRequest()\n\n    # Call the API method through the client object\n    resp = client.DescribeInstances(req)\n\n    # Print the returned response in JSON format\n    print(resp.to_json_string())\n\nexcept TencentCloudSDKException as err:\n    print(f\"An error occurred: {err}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Run the `Install Certificates.command` script found within your Python installation directory on macOS.","message":"On 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.","severity":"gotcha","affected_versions":"Python 3.6+"},{"fix":"Choose either the full SDK or specific product SDKs for installation, but not both simultaneously in one environment.","message":"Do 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Set the `https_proxy` environment variable (e.g., `export https_proxy=\"http://your_proxy_ip:port\"`).","message":"If operating behind a proxy, you must explicitly set the `https_proxy` system environment variable, otherwise, connection timeout exceptions may occur.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly set the language parameter in your client profile or request if you require a different language for responses.","message":"The 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.","severity":"breaking","affected_versions":"v3.0.x onwards (after specific update, exact version not specified but noted as 'latest')"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}