Tencent Cloud TBP SDK for Python
raw JSON → 3.0.1459 verified Sat May 09 auth: no python
Unofficial Tencent Cloud TBP (Task/Bot Platform) SDK for Python, version 3.0.1459. Provides client classes for interacting with TBP services. Released irregularly alongside the main tencentcloud-sdk-python. The package is auto-generated, so breaking changes can occur on minor version bumps due to API additions.
pip install tencentcloud-sdk-python-tbp Common errors
error ModuleNotFoundError: No module named 'tencentcloud' ↓
cause Missing base package tencentcloud-sdk-python-common.
fix
pip install tencentcloud-sdk-python-common
error AttributeError: module 'tencentcloud.tbp' has no attribute 'v20190627' ↓
cause Installed an older version that does not include v20190627.
fix
Upgrade to the latest package: pip install --upgrade tencentcloud-sdk-python-tbp
error tencentcloud.common.exception.TencentCloudSDKException: [InvalidParameter] The specified BotId does not exist. ↓
cause Invalid BotId or BotEnv; check your TBP bot configuration.
fix
Verify BotId and BotEnv in the Tencent Cloud console.
Warnings
gotcha SDK is auto-generated: any minor version bump (e.g., 3.0.1458 → 3.0.1459) can introduce breaking changes. Always pin your dependency. ↓
fix Pin to exact version in requirements.txt: tencentcloud-sdk-python-tbp==3.0.1459
gotcha The package name includes 'tbp' but the import path uses 'tencentcloud.tbp.v20190627'. Mismatch can cause confusion. ↓
fix Use the correct import shown above.
deprecated Older API version modules (e.g., v20190311) are deprecated. Using them will result in import errors or outdated response structures. ↓
fix Update import to v20190627 and review model changes.
Imports
- TbpClient wrong
from tencentcloud.tbp.v20190311 import tbp_clientcorrectfrom tencentcloud.tbp.v20190627 import tbp_client
Quickstart
import os
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.tbp.v20190627 import tbp_client, models
secret_id = os.environ.get('TENCENTCLOUD_SECRET_ID', '')
secret_key = os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
cred = credential.Credential(secret_id, secret_key)
client = tbp_client.TbpClient(cred, "ap-guangzhou")
req = models.TextProcessRequest()
req.BotId = "your_bot_id"
req.BotEnv = "dev"
req.TerminalId = "test_user"
req.InputText = "Hello"
try:
resp = client.TextProcess(req)
print(resp.to_json_string())
except TencentCloudSDKException as e:
print(e)