{"id":28330,"library":"tencentcloud-sdk-python-cws","title":"Tencent Cloud CWS SDK for Python","description":"The official Tencent Cloud SDK module for the CWS (Cloud Web Scanner) service. This package is part of the larger tencentcloud-sdk-python ecosystem, version 3.0.1459. It provides Python bindings for the CWS API, enabling management of web scanning tasks, site verification, and vulnerability detection. Released irregularly alongside the main SDK.","status":"active","version":"3.0.1459","language":"python","source_language":"en","source_url":"https://github.com/TencentCloud/tencentcloud-sdk-python","tags":["tencentcloud","cws","sdk","cloud"],"install":[{"cmd":"pip install tencentcloud-sdk-python-cws","lang":"bash","label":"PyPI"},{"cmd":"pip install tencentcloud-sdk-python-cws==3.0.1459","lang":"bash","label":"Pin version"}],"dependencies":[{"reason":"Required for base client and credential handling.","package":"tencentcloud-sdk-python-common","optional":false}],"imports":[{"note":"CwsClient is inside the versioned subpackage; direct import from 'cws' won't work.","wrong":"from tencentcloud.cws import CwsClient","symbol":"CwsClient","correct":"from tencentcloud.cws.v20180312 import cws_client"}],"quickstart":{"code":"import os\nfrom tencentcloud.common import credential\nfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\nfrom tencentcloud.cws.v20180312 import cws_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 = cws_client.CwsClient(cred, 'ap-guangzhou')\n    req = models.DescribeSitesRequest()\n    resp = client.DescribeSites(req)\n    print(resp.to_json_string())\nexcept TencentCloudSDKException as e:\n    print(e)","lang":"python","description":"Lists all registered web scanning sites. Requires credentials set as environment variables TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY."},"warnings":[{"fix":"Always use 'v20180312' in the import path for the current CWS API.","message":"The module version (3.0.1459) corresponds to the SDK release, not the API version. The CWS API version is v20180312; do not confuse with the SDK version.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Credential(secret_id, secret_key) or Credential(secret_id, secret_key, sessionToken='...') for temporary keys.","message":"The Credential object no longer accepts a 'secret_key' as positional arg after version 3.0.500. Use keyword arguments or Credential(secret_id, secret_key) is still fine (both positional). However, the optional 'token' parameter changed to 'sessionToken'.","severity":"breaking","affected_versions":">=3.0.500"},{"fix":"Replace resp.to_json_string() with resp.to_json() or str(resp).","message":"The method 'to_json_string()' on response objects is deprecated in favor of 'to_json(indent=None)'. While still present, it may be removed.","severity":"deprecated","affected_versions":">=3.0.1000"},{"fix":"Explicitly set the region via environment variable TENCENTCLOUD_REGION or pass a known region string.","message":"Region parameter in client constructor must be a valid Tencent Cloud region string (e.g., 'ap-guangzhou'). An invalid region silently defaults to 'ap-guangzhou' but may cause obscure API errors.","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-cws","cause":"Missing installation of the specific submodule tencentcloud-sdk-python-cws, or mistakenly thinking it's included in the base package.","error":"ModuleNotFoundError: No module named 'tencentcloud.cws'"},{"fix":"Use: from tencentcloud.cws.v20180312 import cws_client","cause":"Incorrect import path; trying to import from tencentcloud.cws directly instead of the versioned subpackage.","error":"AttributeError: module 'tencentcloud.cws' has no attribute 'v20180312'"},{"fix":"Set environment variables TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY properly. For temporary keys, also set TENCENTCLOUD_TOKEN.","cause":"Missing or invalid credentials; either SecretId or SecretKey is empty or incorrect.","error":"tencentcloud.common.exception.tencent_cloud_sdk_exception.TencentCloudSDKException: [InvalidParameter] InvalidParameter"},{"fix":"Check CAM permissions in Tencent Cloud console, or use a key with full CWS access.","cause":"The API key does not have permission to access CWS. Ensure the key is associated with a CAM policy granting CWS actions.","error":"tencentcloud.common.exception.tencent_cloud_sdk_exception.TencentCloudSDKException: [UnauthorizedOperation] UnauthorizedOperation"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}