Tencent Cloud CMQ SDK for Python

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

Tencent Cloud CMQ SDK for Python, part of the Tencent Cloud Python SDK suite. Current version 3.0.1459. Provides client interfaces for Tencent Cloud Message Queue (CMQ) services. Part of a large multi-package SDK with regular releases.

pip install tencentcloud-sdk-python-cmq
error ModuleNotFoundError: No module named 'tencentcloud'
cause Missing 'tencentcloud-sdk-python-common' which provides core package.
fix
pip install tencentcloud-sdk-python-common
error AttributeError: module 'tencentcloud.cmq' has no attribute 'v20190304'
cause The SDK packages are installed separately; cmq v20190304 is not included unless you install 'tencentcloud-sdk-python-cmq'.
fix
pip install tencentcloud-sdk-python-cmq
gotcha Do NOT import from 'tencentcloud.cmq' without version; always use 'tencentcloud.cmq.v20190304'. The top-level cmq package does NOT contain client classes.
fix Import from the versioned subpackage: from tencentcloud.cmq.v20190304 import cmq_client
gotcha The 'tencentcloud-sdk-python-common' package is an implicit dependency but not automatically installed by pip. You must install it separately.
fix Run: pip install tencentcloud-sdk-python-common
breaking SDK v3 dropped support for Python 2.7. If you are still on Python 2, pin to legacy v1 SDK (tencentcloud-sdk-python-intl-en or cn).
fix Use Python 3.6+ or install the legacy SDK (tencentcloud-sdk-python) with version <3.0.

Initialize a CMQ client with credential and region, then create a queue.

from tencentcloud.common import credential
from tencentcloud.cmq.v20190304 import cmq_client, models

cred = credential.Credential(secret_id="your-secret-id", secret_key="your-secret-key")
client = cmq_client.CmqClient(cred, "ap-guangzhou")
req = models.CreateQueueRequest()
req.QueueName = "test-queue"
resp = client.CreateQueue(req)
print(resp.RequestId)