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.1.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.1-py3-none-any.whl (91.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yicloud_sdk_python-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1e18a0eb44a1124fb894142eb9484a6c55df82831e9ccda74f23a6ca713c6143
MD5 99352e2a3b5edf0096254fd4c5489daf
BLAKE2b-256 78dd383b6900ee8ab006fd78ef4d50366c0cb609b8134b29749586846a68fc54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yicloud_sdk_python-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a54e76ddca3da9ce3af965a77f328db4fd42c4ef592e7adaf077da2d50f13689
MD5 b3eac4af32b6ee4b4e15955dd70e1b3e
BLAKE2b-256 428ef1709bb13f4c70e0f5ed06030480ba38f74487c5e2147410a81d9c8c312b

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