Tencent Cloud SSA SDK for Python

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

The official Tencent Cloud SDK for the Security Situational Awareness (SSA) service, providing Python bindings to manage security incidents and risks. Current version: 3.0.1459. Updated frequently, often multiple times per month.

pip install tencentcloud-sdk-python-ssa
error ModuleNotFoundError: No module named 'tencentcloud.ssa'
cause The ssa package is not installed or import path is incorrect.
fix
Install tencentcloud-sdk-python-ssa and use correct import: from tencentcloud.ssa.v20180608 import ssa_client
error AttributeError: module 'tencentcloud.ssa.v20180608' has no attribute 'models'
cause Missing import of models submodule.
fix
Add: from tencentcloud.ssa.v20180608 import models
error tencentcloud.common.exception.tencent_cloud_sdk_exception.TencentCloudSDKException: [TencentCloudSDKException] code: UnsupportedRegion error: the region is not supported
cause Region passed to client is not valid for SSA service.
fix
Use a supported region, e.g., 'ap-guangzhou', 'ap-shanghai', 'ap-beijing'.
gotcha The import path includes a versioned subpackage (v20180608). This version string can change in future SDK releases. Always check the latest API version.
fix Use the import pattern: from tencentcloud.ssa.v20180608 import ...
gotcha Region parameter is required for client initialization. Incorrect region may cause authentication or service errors.
fix Pass a valid Tencent Cloud region (e.g., 'ap-guangzhou') to SsaClient constructor.
gotcha Endpoints default to ssa.tencentcloudapi.com, but may be overridden per region. Check official documentation for region-specific endpoints.
fix Set endpoint via HttpProfile if needed.

Initialize client and describe alert list.

import os
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.ssa.v20180608 import ssa_client, models

try:
    cred = credential.Credential(
        os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
        os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
    )
    httpProfile = HttpProfile()
    httpProfile.endpoint = "ssa.tencentcloudapi.com"
    clientProfile = ClientProfile()
    clientProfile.httpProfile = httpProfile
    client = ssa_client.SsaClient(cred, "ap-guangzhou", clientProfile)

    req = models.DescribeAlertListRequest()
    req.PageIndex = 1
    req.PageSize = 10
    resp = client.DescribeAlertList(req)
    print(resp.to_json_string())
except TencentCloudSDKException as err:
    print(err)