Tencent Cloud CLB SDK for Python

raw JSON →
3.1.82 verified Sat May 09 auth: no python

Official Tencent Cloud SDK for Cloud Load Balancer (CLB). Version 3.1.82. Released on a regular cadence aligned with Tencent Cloud API updates.

pip install tencentcloud-sdk-python-clb
error ModuleNotFoundError: No module named 'tencentcloud.clb'
cause Installed wrong package or missing dependency `tencentcloud-sdk-python-common`
fix
Run pip install tencentcloud-sdk-python-clb tencentcloud-sdk-python-common
error ImportError: cannot import name 'ClbClient' from 'tencentcloud.clb'
cause Incorrect import path: missing version subpackage
fix
Use: from tencentcloud.clb.v20180317 import clb_client
gotcha Do not import the SDK using the package name `tencentcloud-sdk-python-clb`; use the module path `tencentcloud.clb.v20180317`.
fix Use `from tencentcloud.clb.v20180317 import clb_client`.
deprecated The old `ap-shenzhen` region ID is deprecated; use `ap-guangzhou` or other valid regions.
fix Use official region IDs from Tencent Cloud documentation.
breaking Version 3.x reorganized modules; previously working imports like `from tencentcloud.clb import ClbClient` will break.
fix Update imports to include the versioned module path (v20180317).

Quickstart: Create a CLB client and list load balancers.

import os
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.clb.v20180317 import clb_client, models

SecretId = os.environ.get('TENCENTCLOUD_SECRET_ID', '')
SecretKey = os.environ.get('TENCENTCLOUD_SECRET_KEY', '')

cred = credential.Credential(SecretId, SecretKey)
httpProfile = HttpProfile()
httpProfile.endpoint = "clb.tencentcloudapi.com"
clientProfile = ClientProfile(httpProfile=httpProfile)
client = clb_client.ClbClient(cred, 'ap-guangzhou', clientProfile)

req = models.DescribeLoadBalancersRequest()
resp = client.DescribeLoadBalancers(req)
print(resp.to_json_string())