Registry /
aws / tencentcloud-sdk-python-dc
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.
DcClient
✓ from tencentcloud.dc.v20180410 import dc_client
✗ from tencentcloud.dc import client
Versioned import path (v20180410) is required.
List all Direct Connect connections using credentials from environment variables.
import os
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.dc.v20180410 import dc_client, models
try:
cred = credential.Credential(
os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = dc_client.DcClient(cred, 'ap-guangzhou')
req = models.DescribeDirectConnectsRequest()
resp = client.DescribeDirectConnects(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tencentcloud.dc'
Missing or incorrectly installed package; also the common package may be missing.
fixRun: pip install tencentcloud-sdk-python-dc tencentcloud-sdk-python-common
AttributeError: module 'tencentcloud.dc' has no attribute 'v20180410'
The versioned subpackage is not available due to old SDK version or wrong import path.
fixUpgrade to >=3.0.0: pip install --upgrade tencentcloud-sdk-python-dc
tencentcloud.common.exception.tencent_cloud_sdk_exception.TencentCloudSDKException: [TencentCloudSDKException] code: UnauthorizedOperation
Invalid or missing credentials (secret ID/key).
fixSet environment variables TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY correctly.
Upgrade
Version history
3.1.83latest on PyPI · released Apr 21, 2026
Audit
Dependencies
tencentcloud-sdk-python-commonrequiredRequired for all Tencent Cloud services.