Tencent Cloud Yunsou SDK for Python

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

Tencent Cloud Yunsou (Cloud Search) SDK for Python, part of the official Tencent Cloud SDK family. Current version 3.0.1459. Released frequently alongside other Tencent Cloud services.

pip install tencentcloud-sdk-python-yunsou
error ModuleNotFoundError: No module named 'tencentcloud.yunsou.v20180504'
cause Using import path without version or missing installation of the specific package.
fix
Install tencentcloud-sdk-python-yunsou and import as shown in quickstart.
error AttributeError: module 'tencentcloud.yunsou' has no attribute 'YunsouClient'
cause Importing from wrong module level (e.g., from tencentcloud.yunsou import YunsouClient).
fix
Use correct path: from tencentcloud.yunsou.v20180504 import yunsou_client
error TencentCloudSDKException: InvalidParameterValue.ResourceIdNotFound
cause The ResourceId provided does not exist or is misconfigured.
fix
Verify ResourceId from Tencent Cloud Console. Ensure the resource is active.
breaking Import paths changed in v3.x: must include the API version (e.g., v20180504) in the import path. Old style imports will raise ImportError.
fix Use correct import: from tencentcloud.yunsou.v20180504 import yunsou_client
deprecated Environment variable TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY are preferred over hardcoded credentials.
fix Set environment variables or use credential.Credential with env vars.
gotcha The YunsouClient requires a region parameter (e.g., 'ap-guangzhou'). Some products default to a region, but yunsou does not. Missing region will cause a credential or connection error.
fix Always pass a valid region string when initializing the client.

Initialize client and perform a search query.

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.yunsou.v20180504 import yunsou_client, models

try:
    cred = credential.Credential(secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''), secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', ''))
    client = yunsou_client.YunsouClient(cred, "ap-guangzhou")
    req = models.DataSearchRequest()
    req.ResourceId = "your_resource_id"
    req.SearchQuery = "test"
    resp = client.DataSearch(req)
    print(resp.to_json_string())
except TencentCloudSDKException as err:
    print(err)