Tencent Cloud Oceanus SDK
raw JSON → 3.1.79 verified Sat May 09 auth: no python
Tencent Cloud Oceanus SDK for Python provides access to Tencent Cloud's Oceanus (real-time computing) services. The current version is 3.1.79, released from a monorepo under the tencentcloud-sdk-python project. It follows the main SDK's release cadence, with frequent minor updates.
pip install tencentcloud-sdk-python-oceanus Common errors
error ImportError: cannot import name 'OceanusClient' from 'tencentcloud.oceanus.v20190422' ↓
cause Trying to import OceanusClient from the wrong submodule (e.g., from models).
fix
Use: from tencentcloud.oceanus.v20190422 import oceanus_client; client = oceanus_client.OceanusClient(...)
error TencentCloudSDKException: The SecretId and SecretKey are not set correctly ↓
cause Missing or incorrect credentials in environment variables or code.
fix
Set TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY environment variables, or pass them explicitly to credential.Credential.
Warnings
gotcha The SDK uses camelCase for API actions (e.g., DescribeClusters), but the request class is PascalCase (e.g., DescribeClustersRequest). Import models from the same module as the client. ↓
fix from tencentcloud.oceanus.v20190422 import oceanus_client, models
gotcha Credential must be created with secret_id and secret_key, not with token or session_token. The SDK does not support STS by default. ↓
fix Use credential.Credential(secret_id, secret_key) or credential.STSAssumeRoleCredential for temporary keys.
deprecated Older versions (pre-3.0) used a different package name and import structure. If you see imports from 'oceanus' or 'qcloudoceanus', you are using a deprecated version. ↓
fix Upgrade to tencentcloud-sdk-python-oceanus and use the new import paths.
Imports
- OceanusClient wrong
from tencentcloud.oceanus.v20190422.models import OceanusClientcorrectfrom tencentcloud.oceanus.v20190422 import oceanus_client
Quickstart
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.oceanus.v20190422 import oceanus_client, models
try:
cred = credential.Credential(
secret_id=os.environ.get('TENCENTCLOUD_SECRET_ID', ''),
secret_key=os.environ.get('TENCENTCLOUD_SECRET_KEY', '')
)
client = oceanus_client.OceanusClient(cred, "ap-guangzhou")
req = models.DescribeClustersRequest()
resp = client.DescribeClusters(req)
print(resp.to_json_string())
except TencentCloudSDKException as e:
print(e)