Skip to main content

YiCloud OpenAPI SDK for Python

Project description

OpenAPI SDK for Python

A Python SDK for the OpenAPI service.

Installation

使用 pip 安装(推荐):

pip install yicloud-sdk-python

从源码安装(不推荐): git clone https://gitee.com/yicloud-team/openapi-sdk-python.git cd openapi-sdk-python pip install -e .

Configuration

The SDK reads configuration from environment variables:

Variable Default Description
YICLOUD_API_HOST https://gate.yicloud.com API endpoint
YICLOUD_TIMEOUT 30 Timeout in seconds
YICLOUD_MAX_RETRIES 0 Max retry attempts
YICLOUD_PUBLIC_KEY - Access key (required)
YICLOUD_SECRET_KEY - Secret key (required)

Usage

import yicloud.base as base
from yicloud.services import iam
from yicloud.base import msgs

# Create config (reads from env vars)
cfg = base.new_config()
cfg.log_level = base.log.Level.DEBUG
cfg.timeout = 10

# Create credential (reads from env vars)
credential = base.new_credential()

# Create client
client = base.new_client(
    base.with_config(cfg),
    base.with_credential(credential),
)

# Inject client into service
iam.use_client(client)

# Create metadata context
ctx, meta = msgs.new_meta_ctx()

# Call API
try:
    user_data = iam.get_user(ctx, iam.GetUserReq(UserName="admin"))
    print(f"成功返回: {user_data}, RequestID={meta.request_id}")
except base.exc.ServerException as e:
    print(f"后端错误: action={e.action}, code={e.code}, message={e.message}")
except base.exc.ClientException as e:
    print(f"客户端错误: action={e.action}")
except base.exc.YiCloudException as e:
    print(f"SDK 错误: {e}")

Services

Service Package Actions Description
IAM yicloud.services.iam 22 User, AccessKey, Project, QuotaGroup management
Job yicloud.services.job 11 Job lifecycle, logs, replicas
MC yicloud.services.mc 16 Node, SKU, Project, QuotaGroup management
FS yicloud.services.fs 7 Fileset, directory operations
OSS yicloud.services.oss 5 Bucket CRUD
Registry yicloud.services.registry 14 Image and repository management
ModelRepo yicloud.services.modelrepo 11 Model and version management
ModelSet yicloud.services.modelset 9 ModelSet lifecycle and scaling
BC yicloud.services.bc 1 Billing details

Project Structure

yicloud/                    # Main package
├── base/                   # Infrastructure
│   ├── client.py           # HTTP client (Get/Post)
│   ├── config.py           # Configuration
│   ├── exc.py              # Exception types
│   ├── auth/               # HMAC-SHA256 signing
│   ├── log/                # Logger
│   ├── msgs/               # Response types (Rsp[T], Header, RspMeta)
│   └── utils/              # Utilities
└── services/               # Business services (9 services)
    ├── iam/                # Identity & Access Management
    ├── job/                # Job management
    ├── mc/                 # Multi-cluster management
    ├── fs/                 # Filesystem management
    ├── oss/                # Object storage
    ├── registry/           # Container registry
    ├── modelrepo/          # Model repository
    ├── modelset/           # ModelSet lifecycle
    └── bc/                 # Billing center
examples/                   # Example code (one per service)

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

yicloud_sdk_python-0.1.0.tar.gz (37.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yicloud_sdk_python-0.1.0-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

Details for the file yicloud_sdk_python-0.1.0.tar.gz.

File metadata

  • Download URL: yicloud_sdk_python-0.1.0.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for yicloud_sdk_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1cb83e7e392c6c03ef753454bcd3498834c1610715112e8fafb8f8c5c7f7dbf8
MD5 eca2c454e0e8125e7b1d075f09e7692f
BLAKE2b-256 6cd74f2a30bd051986a7abc700c34e0097b02622ecc5cd0c160ee601ceef80ef

See more details on using hashes here.

File details

Details for the file yicloud_sdk_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for yicloud_sdk_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c6eab82e5810fe199622026536a9a0b1924e5da6a8c354c95e1c3d24b88247d
MD5 ac51653ff6cf27d78f0ecab1483a45c3
BLAKE2b-256 5b8d654c68c99bddcae21428ca176d606a25726984da92782ae71984af0cf092

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page