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
BC yicloud.services.bc 5 账单管理 BC
Dataset yicloud.services.dataset 10 数据集 DATASET
FS yicloud.services.fs 8 文件系统 FS
IAM yicloud.services.iam 12 访问控制 IAM
Inferset yicloud.services.inferset 14 模型推理服务 INFERSET
JOB yicloud.services.job 13 训练任务 JOB
MC yicloud.services.mc 26 管理中心 MC
Modelrepo yicloud.services.modelrepo 11 模型仓库 MODELREPO
Monitor yicloud.services.monitor 1 监控中心 MONITOR
OSS yicloud.services.oss 5 对象存储OSS
RAY yicloud.services.ray 9 分布式计算 Ray
Registry yicloud.services.registry 12 镜像仓库 REGISTRY
Volume yicloud.services.volume 12 云盘管理 Volume
Workspace yicloud.services.workspace 21 开发机 WS

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 (14 services)
    ├── bc/         # 账单管理 BC
    ├── dataset/    # 数据集 DATASET
    ├── fs/         # 文件系统 FS
    ├── iam/        # 访问控制 IAM
    ├── inferset/   # 模型推理服务 INFERSET
    ├── job/        # 训练任务 JOB
    ├── mc/         # 管理中心 MC
    ├── modelrepo/  # 模型仓库 MODELREPO
    ├── monitor/    # 监控中心 MONITOR
    ├── oss/        # 对象存储OSS
    ├── ray/        # 分布式计算 Ray
    ├── registry/   # 镜像仓库 REGISTRY
    ├── volume/     # 云盘管理 Volume
    ├── workspace/  # 开发机 WS
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.2.0.tar.gz (69.2 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.2.0-py3-none-any.whl (91.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yicloud_sdk_python-0.2.0.tar.gz
  • Upload date:
  • Size: 69.2 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.2.0.tar.gz
Algorithm Hash digest
SHA256 64a874b0a59c0f0c12ad8fc0ead39799ab9d0912ffd5be617ba4b5ca8cf7b570
MD5 5e413ade67a0177020dd3db910048294
BLAKE2b-256 4b53441c970bea8c9e5cc91af5da8b904f1e1d61acbbbeb2c85fda5ce85a7c4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yicloud_sdk_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f3abf209459c4d9bda7766aa27426bcb1264b728fc6b90620da76775a880ba5
MD5 7534a5051d1b75d04eda80ed0828258f
BLAKE2b-256 9aa13c4978b49d24d09775fef3508d2e7f34ea122a497f83032943be892c170b

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