Tencent Cloud ECDN SDK for Python
raw JSON → 3.0.1459 verified Sat May 09 auth: no python
Official Tencent Cloud SDK for Enterprise Content Delivery Network (ECDN) services. Current version 3.0.1459, released weekly alongside the main tencentcloud-sdk-python suite. Provides Pythonic access to ECDN APIs including domain management, log reporting, and DSA configuration.
pip install tencentcloud-sdk-python-ecdn Common errors
error ImportError: cannot import name 'EcdnClient' from 'tencentcloud.ecdn.v20191012.ecdn_client' ↓
cause Python may sometimes resolve the module as a script and the class is not at top-level; the correct import is the module itself.
fix
Use: from tencentcloud.ecdn.v20191012 import ecdn_client; then ecdn_client.EcdnClient
error tencentcloud.common.exception.TencentCloudSDKException: [TencentCloudSDKException] code: AuthFailure.SecretIdNotFound ↓
cause Missing or invalid secret ID/Key environment variables.
fix
Set TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY environment variables correctly.
error AttributeError: 'EcdnClient' object has no attribute 'DescribeDomainsConfig' ↓
cause Using an older or mismatched API version where the method does not exist.
fix
Ensure you are using the correct API version (v20191012) and upgrading to the latest SDK version.
error TypeError: __init__() got an unexpected keyword argument 'secret_id' ↓
cause Credential class expects positional arguments in older versions; or using old credential pattern.
fix
Use credential.Credential(secret_id, secret_key) without keyword arguments or upgrade to latest SDK.
Warnings
breaking In v3.0.1000+, the 'from tencentcloud.ecdn.v20191012 import ecdn_client' pattern is required; older direct import of EcdnClient class from the ecdn_client module may cause ImportError. ↓
fix Use 'from tencentcloud.ecdn.v20191012 import ecdn_client' then reference ecdn_client.EcdnClient.
deprecated The v20191012 API version is the only available version for ECDN; do not attempt to import other versions (e.g., v2018...). ↓
fix Always use v20191012 in the import path.
gotcha Region parameter is required even for global services; incorrectly setting region to empty string leads to an AuthenticationError. ↓
fix Specify an actual region like 'ap-guangzhou' or use client.set_region() after initialization.
gotcha When using async client (EcdnClient from async version), you must import from the same module but the async variant is not available in this package; must install tencentcloud-sdk-python-common with async extras. ↓
fix Install 'pip install tencentcloud-sdk-python-common[async]' for async support, then import from tencentcloud.ecdn.v20191012.async_ecdn_client.
Imports
- EcdnClient wrong
from tencentcloud.ecdn.v20191012.ecdn_client import EcdnClientcorrectfrom tencentcloud.ecdn.v20191012 import ecdn_client
Quickstart
from tencentcloud.common import credential
from tencentcloud.ecdn.v20191012 import ecdn_client
from tencentcloud.ecdn.v20191012 import models
cred = credential.Credential(
secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = ecdn_client.EcdnClient(cred, 'ap-guangzhou')
req = models.DescribeDomainsConfigRequest()
resp = client.DescribeDomainsConfig(req)
print(resp.to_json_string())