{"id":28372,"library":"tencentcloud-sdk-python-tsw","title":"Tencent Cloud Tsw SDK for Python","description":"Tencent Cloud Tsw (Tencent Service Weaver) SDK for Python, part of the official Tencent Cloud SDK. Version 3.0.1459. Released as part of the tencentcloud-sdk-python family; follows the same release cadence as the parent SDK.","status":"active","version":"3.0.1459","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencentcloud","tsw","sdk","cloud"],"install":[{"cmd":"pip install tencentcloud-sdk-python-tsw","lang":"bash","label":"Install Tsw SDK"}],"dependencies":[{"reason":"Required for credential handling and API client base classes","package":"tencentcloud-sdk-python-common","optional":false}],"imports":[{"note":"Import must specify the API version (v20200924) and use the module tsw_client","wrong":"from tencentcloud.tsw import TswClient","symbol":"TswClient","correct":"from tencentcloud.tsw.v20200924 import tsw_client"},{"note":"The models module is version-specific and must be imported from the correct API version subpackage","wrong":"import models","symbol":"models","correct":"from tencentcloud.tsw.v20200924 import models"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\nfrom tencentcloud.tsw.v20200924 import tsw_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 = tsw_client.TswClient(cred, 'ap-guangzhou')\n    req = models.DescribeComponentAlertObjectRequest()\n    resp = client.DescribeComponentAlertObject(req)\n    print(resp.to_json_string())\nexcept TencentCloudSDKException as err:\n    print(err)","lang":"python","description":"Initialize the TswClient and make a sample API call. Replace region and request as needed."},"warnings":[{"fix":"Always pass the region string, e.g., 'ap-guangzhou', to the TswClient constructor.","message":"The TswClient constructor expects a 'region' parameter; omitting it will cause silent failures or use a default region not suitable for Tsw.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the full versioned import path: tencentcloud.tsw.v20200924","message":"Older imports without version (e.g., from tencentcloud.tsw import tsw_client) are deprecated and may be removed in future releases.","severity":"deprecated","affected_versions":"<3.0.1000"},{"fix":"Always use 'v20200924' when importing Tsw modules.","message":"The API version '20200924' is the only version available; using a different version string will result in ModuleNotFoundError.","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-tsw' and import using 'from tencentcloud.tsw.v20200924 import tsw_client'.","cause":"The tencentcloud-sdk-python-tsw package is not installed or the import path is incorrect.","error":"ModuleNotFoundError: No module named 'tencentcloud.tsw'"},{"fix":"Use 'from tencentcloud.tsw.v20200924 import tsw_client' and then tsw_client.TswClient().","cause":"Direct import of class name without using the correct module (tsw_client).","error":"AttributeError: module 'tencentcloud.tsw.v20200924' has no attribute 'TswClient'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}