Tencent Cloud Solar SDK for Python

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

Tencent Cloud Solar SDK for Python enables developers to interact with Tencent Cloud Solar services. Version 3.0.1394. Released as part of the Tencent Cloud SDK family with frequent updates.

pip install tencentcloud-sdk-python-solar
error ModuleNotFoundError: No module named 'tencentcloud.solar'
cause The 'tencentcloud-sdk-python-solar' package not installed, or installed without the common package.
fix
Run: pip install tencentcloud-sdk-python-solar tencentcloud-sdk-python-common
error tencentcloud.common.exception.TencentCloudSDKException: The SecretId is not found
cause Environment variables TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY not set.
fix
Set secret id and key via environment variables or pass directly.
gotcha The API version (v20181011) is hardcoded in imports. Check the latest version in documentation if API changes.
fix Always use the version as shown in the official docs; currently v20181011.
deprecated The solar service might be deprecated or replaced. Confirm in Tencent Cloud console.
fix Verify service availability on Tencent Cloud official site.

Instantiate client and make a request to describe a solar project.

import os
from tencentcloud.common import credential
from tencentcloud.solar.v20181011 import solar_client, models

try:
    cred = credential.Credential(
        os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
        os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
    )
    client = solar_client.SolarClient(cred, 'ap-guangzhou')
    req = models.DescribeProjectRequest()
    req.ProjectId = 'your_project_id'
    resp = client.DescribeProject(req)
    print(resp.to_json_string())
except Exception as e:
    print('Error:', e)