Tencent Cloud Game Multimedia Engine (GME) Python SDK
raw JSON → 3.1.42 verified Sat May 09 auth: no python
Official Python SDK for Tencent Cloud Game Multimedia Engine (GME), enabling voice chat, voice message, and voice recognition services. Current version 3.1.42. Release cadence is irregular, typically following the main tencentcloud-sdk-python releases.
pip install tencentcloud-sdk-python-gme Common errors
error ImportError: cannot import name 'GmeClient' from 'tencentcloud.gme' ↓
cause Incorrect import path; GmeClient is inside the versioned submodule.
fix
from tencentcloud.gme.v20180711 import gme_client; then use gme_client.GmeClient
error AttributeError: module 'tencentcloud.common.credential' has no attribute 'Credential' ↓
cause Importing credential incorrectly; use credential.Credential, not credential.
fix
from tencentcloud.common import credential; cred = credential.Credential(SecretId, SecretKey)
error TencentCloudSDKException: [TencentCloudSDKException] code: UnauthorizedOperation message: Invalid secretId ↓
cause SecretId or SecretKey is incorrect or not set.
fix
Set SECRET_ID and SECRET_KEY environment variables, or hardcode valid credentials for testing.
Warnings
breaking In version 3.0+, the API module version must be specified (e.g., gme.v20180711). Omitting the version causes import errors. ↓
fix Always use the full import path: tencentcloud.gme.v20180711.gme_client
deprecated The credential.Credential() constructor with three arguments (including region) is deprecated. Use Credential(SecretId, SecretKey) and pass region to client separately. ↓
fix cred = credential.Credential(SecretId, SecretKey); client = gme_client.GmeClient(cred, 'ap-guangzhou')
gotcha Many GME API response objects contain nested structures; calling to_json_string() fails if the object has unset optional fields. Use json.dumps with custom encoder to avoid AttributeError. ↓
fix Use json.dumps(resp, default=lambda o: o.__dict__) or convert to dict via vars() before serialization.
Imports
- GmeClient wrong
from tencentcloud.gme import GmeClientcorrectfrom tencentcloud.gme.v20180711 import gme_client as gme_client_module - DescribeApplicationDataRequest wrong
from tencentcloud.gme import modelscorrectfrom tencentcloud.gme.v20180711 import models
Quickstart
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.gme.v20180711 import gme_client, models
SecretId = os.environ.get('SECRET_ID', '')
SecretKey = os.environ.get('SECRET_KEY', '')
cred = credential.Credential(SecretId, SecretKey)
client = gme_client.GmeClient(cred, "ap-guangzhou")
req = models.DescribeApplicationDataRequest()
req.AppId = "your_app_id"
try:
resp = client.DescribeApplicationData(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)