Tencent Cloud Ba SDK

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

Tencent Cloud Ba SDK enables interaction with Tencent Cloud's Ba (Business Analytics) services. Current version 3.0.1459, released regularly via PyPI. The SDK is auto-generated and follows the main tencentcloud-sdk-python pattern.

pip install tencentcloud-sdk-python-ba
error ModuleNotFoundError: No module named 'tencentcloud.ba'
cause Missing or wrong package name. Users sometimes install 'tencentcloud-sdk-python' meta-package instead of the specific service package.
fix
pip install tencentcloud-sdk-python-ba
error tencentcloud.common.exception.TencentCloudSDKException: [TencentCloudSDKException] code: UnsupportedOperation, message: This action not supported.
cause Calling an API method that does not exist in the Ba service. Possibly a typo or using a method from another service.
fix
Verify the available methods in the Ba client. The correct method names are defined in models. For example, use client.DescribeBaApis() not client.DescribeInstances().
error KeyError: 'BA'
cause Using an old, incorrect module path without version date (e.g., from tencentcloud.ba import BaClient). The SDK restructured around v3.0.1000.
fix
Use from tencentcloud.ba.v20200720 import ba_client
error AttributeError: module 'tencentcloud.ba' has no attribute 'v20200720'
cause The package is not installed or is an outdated version (<3.0.1000).
fix
pip install --upgrade tencentcloud-sdk-python-ba
gotcha Import path must include version date. The correct import is from tencentcloud.ba.v20200720 import ba_client, not from tencentcloud.ba import ba_client.
fix Use the full versioned module path: from tencentcloud.ba.v20200720 import ba_client, models
deprecated The old credential class 'Cred' (from tencentcloud.common.credential) has been renamed to 'Credential'.
fix Use from tencentcloud.common import credential; cert = credential.Credential(secret_id, secret_key)
gotcha Region parameter in client constructor must be a valid Tencent Cloud region string (e.g., 'ap-guangzhou'). Passing None or empty string will cause 'Region is missing' error.
fix Always provide a valid region string, e.g., client = BaClient(cred, 'ap-guangzhou')

Instantiate BaClient with credentials and call a sample API.

from tencentcloud.common import credential
from tencentcloud.ba.v20200720 import ba_client, models
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException

cred = credential.Credential(
    secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
    secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = ba_client.BaClient(cred, 'ap-guangzhou')
try:
    req = models.DescribeBaApisRequest()
    resp = client.DescribeBaApis(req)
    print(resp.to_json_string())
except TencentCloudSDKException as e:
    print(e)