Tencent Cloud Organization SDK

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

Tencent Cloud Organization SDK for Python, version 3.1.88. Provides access to Tencent Cloud Organization service APIs (e.g., Organization, Organizations). Part of the tencentcloud-sdk-python family. Released periodically alongside the main SDK.

pip install tencentcloud-sdk-python-organization
error ModuleNotFoundError: No module named 'tencentcloud'
cause The common SDK package (tencentcloud-sdk-python-common) is missing.
fix
pip install tencentcloud-sdk-python-common
error ImportError: cannot import name 'OrganizationClient' from 'tencentcloud.organization.v20210331'
cause Wrong package version or the API version module doesn't exist.
fix
Ensure you have the correct package: pip install tencentcloud-sdk-python-organization. Use from tencentcloud.organization.v20210331 import organization_client and then organization_client.OrganizationClient
gotcha The package is only one of many service-specific packages. You must also install tencentcloud-sdk-python-common separately or as a dependency—pip does not pull it automatically if you install only tencentcloud-sdk-python-organization.
fix Install both: pip install tencentcloud-sdk-python-common tencentcloud-sdk-python-organization
deprecated Older SDK versions (pre-3.0) used a different import structure. The 3.x branch uses tencentcloud.organization.v20210331 for the Organization API.
fix Upgrade to latest version and follow the 3.x import style.
gotcha Region parameter is mandatory in client initialization even for global services. Using incorrect region may cause product not found errors.
fix Always provide a valid region (e.g., 'ap-guangzhou'). Check Tencent Cloud documentation for correct region list.

Minimal example to call CreateOrganization API.

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.organization.v20210331 import organization_client, models

# Replace with your credentials
def create_organization():
    try:
        cred = credential.Credential(
            secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
            secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
        )
        client = organization_client.OrganizationClient(cred, "ap-guangzhou")
        req = models.CreateOrganizationRequest()
        resp = client.CreateOrganization(req)
        print(resp.to_json_string())
    except TencentCloudSDKException as err:
        print(err)

if __name__ == '__main__':
    import os
    create_organization()