{"id":28329,"library":"tencentcloud-sdk-python-dc","title":"Tencent Cloud Direct Connect SDK for Python","description":"Official Tencent Cloud SDK for Python, providing access to the Direct Connect (DC) service. Version 3.1.83, released weekly.","status":"active","version":"3.1.83","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencentcloud","sdk","dc","direct-connect","cloud"],"install":[{"cmd":"pip install tencentcloud-sdk-python-dc","lang":"bash","label":"Install via pip"},{"cmd":"pip install tencentcloud-sdk-python-common","lang":"bash","label":"Install common dependency"}],"dependencies":[{"reason":"Required for all Tencent Cloud services.","package":"tencentcloud-sdk-python-common","optional":false}],"imports":[{"note":"Versioned import path (v20180410) is required.","wrong":"from tencentcloud.dc import client","symbol":"DcClient","correct":"from tencentcloud.dc.v20180410 import dc_client"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\nfrom tencentcloud.dc.v20180410 import dc_client, models\n\ntry:\n    cred = credential.Credential(\n        os.environ.get('TENCENTCLOUD_SECRET_ID', ''),\n        os.environ.get('TENCENTCLOUD_SECRET_KEY', '')\n    )\n    client = dc_client.DcClient(cred, 'ap-guangzhou')\n    req = models.DescribeDirectConnectsRequest()\n    resp = client.DescribeDirectConnects(req)\n    print(resp.to_json_string())\nexcept TencentCloudSDKException as err:\n    print(err)","lang":"python","description":"List all Direct Connect connections using credentials from environment variables."},"warnings":[{"fix":"Use from tencentcloud.dc.v20180410 import dc_client instead of old top-level paths.","message":"The SDK package structure changed in v3.0.0. Imports now require versioned subpackages (e.g., v20180410).","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Use credential.Credential(secret_id, secret_key) and set TENCENTCLOUD_SECRET_ID/KEY.","message":"The old credential provider (CommonClient) is deprecated; use credential.Credential with environment variables.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Run requests in a thread pool or use a separate thread executor.","message":"The SDK does not support async (asyncio) natively. Using it in async frameworks may cause blocking.","severity":"gotcha","affected_versions":"all"},{"fix":"Always pass the region string to DcClient(cred, region).","message":"Region must be specified on client creation (e.g., 'ap-guangzhou'). Missing region leads to empty responses.","severity":"gotcha","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-dc tencentcloud-sdk-python-common","cause":"Missing or incorrectly installed package; also the common package may be missing.","error":"ModuleNotFoundError: No module named 'tencentcloud.dc'"},{"fix":"Upgrade to >=3.0.0: pip install --upgrade tencentcloud-sdk-python-dc","cause":"The versioned subpackage is not available due to old SDK version or wrong import path.","error":"AttributeError: module 'tencentcloud.dc' has no attribute 'v20180410'"},{"fix":"Set environment variables TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY correctly.","cause":"Invalid or missing credentials (secret ID/key).","error":"tencentcloud.common.exception.tencent_cloud_sdk_exception.TencentCloudSDKException: [TencentCloudSDKException] code: UnauthorizedOperation"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}