Tencent Cloud MPS SDK for Python
raw JSON → 3.1.92 verified Sat May 09 auth: no python
Tencent Cloud Media Processing Service (MPS) Python SDK. Current version 3.1.92. Released as part of the tencentcloud-sdk-python monorepo; follows TencentCloud SDK release cadence (weekly updates).
pip install tencentcloud-sdk-python-mps Common errors
error ImportError: cannot import name 'MpsClient' from 'tencentcloud.mps' ↓
cause Using wrong import path for MpsClient. The class is located under the versioned subpackage.
fix
Use: from tencentcloud.mps.v20190612 import mps_client
error tencentcloud.common.exception.TencentCloudSDKException: [InvalidParameter] InvalidParameter ↓
cause Often caused by an invalid region or unsupported API action for the MPS product.
fix
Verify region (e.g., ap-guangzhou) and check that the API action (e.g., DescribeTasks) is available in the MPS documentation.
Warnings
breaking SDK v3 introduced new package structure under tencentcloud.mps.v20190612. Code written for v2.x (tencentcloud-sdk-python < 3) using `from tencentcloud.mps import MpsClient` will break. ↓
fix Update imports to use versioned subpackage: `from tencentcloud.mps.v20190612 import mps_client, models`.
deprecated The old credential method using `credential.Credential(secret_id, secret_key)` is still supported but deprecated. New code should use `credential.Credential(secret_id, secret_key, token=...)` for STS or environment variables. ↓
fix Prefer using environment variables TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY, or use STS token.
gotcha Region parameter is mandatory and must be a valid Tencent Cloud region (e.g., ap-guangzhou, ap-beijing). Using an incorrect region may result in 'InvalidParameter' errors. ↓
fix Check region availability in Tencent Cloud documentation and ensure it matches your resource location.
Imports
- MpsClient wrong
from tencentcloud.mps import MpsClientcorrectfrom tencentcloud.mps.v20190612 import mps_client - models wrong
from tencentcloud.mps import modelscorrectfrom tencentcloud.mps.v20190612 import models
Quickstart
import os
from tencentcloud.common import credential
from tencentcloud.mps.v20190612 import mps_client, models
cred = credential.Credential(
os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = mps_client.MpsClient(cred, "ap-guangzhou")
req = models.DescribeTasksRequest()
try:
resp = client.DescribeTasks(req)
print(resp.to_json_string())
except Exception as e:
print("Error:", e)