A wrapper for tencentcloud-sdk-python-common
Project description
pyqcloud-sdk
English · 简体中文
pyqcloud-sdk is a Python package that simplifies the calling of Tencent Cloud product APIs. With just a product ID, region, operation code, and request parameters, you can achieve API calls. The main features are:
- Simplified and unified API calling method
- Automatic handling of authentication, region, and client settings
- Supports all services supported by the original SDK
- Supports custom log configuration
- Based on tencentcloud-sdk-python-common, providing a higher-level abstraction
- Pre-fetches product interface information from tencentcloud-sdk-python
Installation
Install using pip:
pip install pyqcloud-sdk
Supports Python 3.6+
Quick Start
import logging
from pyqcloud_sdk import Services, setup_logging
# Set up logging (optional)
setup_logging(level=logging.INFO)
# Initialize service
service = Services(
name="cvm", # Service name, required
region="ap-guangzhou", # Region, required
secret_id="your_secret_id", # Optional, default reads from environment variable
secret_key="your_secret_key", # Optional, default reads from environment variable
version="2017-03-12" # Optional, API version, default is the latest version
)
# Call API
response = service.call("DescribeInstances", {"Limit": 1})
print(response)
Authentication Configuration
It is recommended to set authentication information using environment variables:
- Default reads
TENCENTCLOUD_SECRET_IDandTENCENTCLOUD_SECRET_KEY - Use
set_secret_from_env()to specify custom environment variable names:
service.set_secret_from_env('CUSTOM_ID_ENV', 'CUSTOM_KEY_ENV')
Error Handling
from pyqcloud_sdk.exceptions import ServiceError, ClientError
try:
response = service.call("DescribeInstances", {})
except ServiceError as e:
print(f"Service error: {e}")
except ClientError as e:
print(f"Client error: {e}")
...
Custom Logging
from pyqcloud_sdk import setup_logging
import logging
setup_logging(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
Notes
- Keep SecretId and SecretKey safe and avoid leakage.
- In production environments, it is recommended to store sensitive information using environment variables or configuration files.
- This package automatically handles most API call retries, but special cases may require custom retry logic.
- Before using, ensure that the necessary access permissions have been granted in the Tencent Cloud console and that the corresponding services have been enabled.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Related Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyqcloud_sdk-0.0.3.tar.gz.
File metadata
- Download URL: pyqcloud_sdk-0.0.3.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f6a2ddf0ac6be27c4f1d4cfa86f0c5e943dc41f76092e60fa5a93701eee4ab
|
|
| MD5 |
c9afd89554c368ec44a476a47f54796a
|
|
| BLAKE2b-256 |
34622f52e54b18eb50c907fb13a5f12c8607d0ebdec170ef0d08728b01d8508b
|
Provenance
The following attestation bundles were made for pyqcloud_sdk-0.0.3.tar.gz:
Publisher:
publish.yml on YongSangUn/pyqcloud-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyqcloud_sdk-0.0.3.tar.gz -
Subject digest:
13f6a2ddf0ac6be27c4f1d4cfa86f0c5e943dc41f76092e60fa5a93701eee4ab - Sigstore transparency entry: 172915598
- Sigstore integration time:
-
Permalink:
YongSangUn/pyqcloud-sdk@11ed6252347c8d8e70f750d1b866083e497024ec -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/YongSangUn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@11ed6252347c8d8e70f750d1b866083e497024ec -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyqcloud_sdk-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pyqcloud_sdk-0.0.3-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba6c89514033a01edf03da2dcae7ea4ea2b0501895e5c464bc3c4ea3025eb0dd
|
|
| MD5 |
135caa95617d526fe66cf727dfe0708f
|
|
| BLAKE2b-256 |
9525ef6f1a335cfb94bcfe94157129f4b2b1346f3327707972576572c7e008cb
|
Provenance
The following attestation bundles were made for pyqcloud_sdk-0.0.3-py3-none-any.whl:
Publisher:
publish.yml on YongSangUn/pyqcloud-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyqcloud_sdk-0.0.3-py3-none-any.whl -
Subject digest:
ba6c89514033a01edf03da2dcae7ea4ea2b0501895e5c464bc3c4ea3025eb0dd - Sigstore transparency entry: 172915604
- Sigstore integration time:
-
Permalink:
YongSangUn/pyqcloud-sdk@11ed6252347c8d8e70f750d1b866083e497024ec -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/YongSangUn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@11ed6252347c8d8e70f750d1b866083e497024ec -
Trigger Event:
release
-
Statement type: