{"id":28324,"library":"tencentcloud-sdk-python-cdn","title":"Tencent Cloud CDN SDK for Python","description":"Official Tencent Cloud SDK for the Content Delivery Network (CDN) service. Version 3.1.89. Monthly release cadence closely following the SDK generator.","status":"active","version":"3.1.89","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencent-cloud","cdn","sdk","cloud","content-delivery-network"],"install":[{"cmd":"pip install tencentcloud-sdk-python-cdn","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The top-level package does not contain the client class directly. Must import from the versioned module.","wrong":"from tencentcloud.cdn import CdnClient","symbol":"CdnClient","correct":"from tencentcloud.cdn.v20180606 import cdn_client"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.cdn.v20180606 import cdn_client, models\n\ncred = credential.Credential(\n    os.environ.get('TENCENTCLOUD_SECRET_ID', ''),\n    os.environ.get('TENCENTCLOUD_SECRET_KEY', '')\n)\nclient = cdn_client.CdnClient(cred, \"ap-guangzhou\")\nreq = models.DescribeCdnDataRequest()\nreq.Metric = \"flux\"\nreq.Domain = \"example.com\"\nreq.StartTime = \"2023-01-01 00:00:00\"\nreq.EndTime = \"2023-01-02 00:00:00\"\nresp = client.DescribeCdnData(req)\nprint(resp)","lang":"python","description":"Standard quickstart using environment variables for credentials and calling DescribeCdnData."},"warnings":[{"fix":"Uninstall the old package (pip uninstall tencentcloud-sdk-python) and install per-service package: pip install tencentcloud-sdk-python-cdn.","message":"In version 3.0.x and earlier, SDK was installed as a monolithic 'tencentcloud-sdk-python' package. Now each service is a separate package. Ensure you install the correct specific package for CDN.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Always specify a valid region string, typically 'ap-guangzhou' for CDN.","message":"The client constructor requires a region (e.g., 'ap-guangzhou') as second argument, even for global services like CDN. Using an empty string may lead to unexpected behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Credential constructor with environment variables or assume-role.","message":"The older authentication method using SecretId/SecretKey directly in code is discouraged. Use environment variables or Tencent Cloud CAM roles.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'pip install tencentcloud-sdk-python-cdn'. This installs the common dependency automatically.","cause":"Missing base tencentcloud-sdk-python package or the specific CDN package.","error":"ModuleNotFoundError: No module named 'tencentcloud'"},{"fix":"Use the correct import: from tencentcloud.cdn.v20180606 import cdn_client","cause":"Attempting to import from 'tencentcloud.cdn' directly without specifying versioned module.","error":"AttributeError: module 'tencentcloud' has no attribute 'cdn'"},{"fix":"Verify request model fields using the API documentation. Use the correct model class from models module.","cause":"Incorrect request parameters or malformed JSON. Often due to missing required fields like 'Domain' or wrong date format.","error":"tencentcloud.common.exception.TencentCloudSDKException: Failed to parse SSEResponse"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}