Tencent Cloud Redis SDK for Python

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

Official Tencent Cloud SDK for managing Redis instances via their CREDIS API. Current version 3.1.78. Released frequently alongside the main tencentcloud-sdk-python monorepo.

pip install tencentcloud-sdk-python-redis
error ModuleNotFoundError: No module named 'tencentcloud.redis'
cause Missing dependency: tencentcloud-sdk-python-redis is not installed, or the parent package tencentcloud-sdk-python-common is missing.
fix
Run pip install tencentcloud-sdk-python-redis (automatically pulls common).
error AttributeError: module 'tencentcloud.redis' has no attribute 'v20180412'
cause Import path is incorrect; the version subpackage may not be loaded if using a top-level import.
fix
Use explicit import: from tencentcloud.redis.v20180412 import redis_client.
error tencentcloud.common.exception.TencentCloudSDKException: [InvalidParameter] InvalidParameter
cause Region parameter is missing or invalid in the request.
fix
Check that the region passed to RedisClient is a valid region code (e.g., 'ap-guangzhou'). Set environment variable or pass directly.
breaking In version 3.1.x, the client class moved from `redis_client.RedisClient` to the versioned path `tencentcloud.redis.v20180412.redis_client.RedisClient`.
fix Use the versioned import as shown in quickstart. Old imports like `from tencentcloud.redis import RedisClient` will fail.
gotcha The SDK silently uses a default region (often 'ap-guangzhou') if none is provided. This can cause unexpected API calls to the wrong region.
fix Always explicitly pass a region to the client constructor.
deprecated The old credential environment variables (e.g., `TENCENTCLOUD_SECRET_ID` and `TENCENTCLOUD_SECRET_KEY`) are being replaced by `TENCENTCLOUD_ACCESS_KEY` and `TENCENTCLOUD_SECRET_ACCESS_KEY`.
fix Use the new variable names. The old ones still work but may be removed in future.

Authenticate and list Redis instances.

import os
from tencentcloud.common import credential
from tencentcloud.redis.v20180412 import redis_client, models

cred = credential.Credential(
    os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
    os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = redis_client.RedisClient(cred, 'ap-guangzhou')
req = models.DescribeInstancesRequest()
resp = client.DescribeInstances(req)
print(resp.to_json_string())