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.3.1.tar.gz (77.3 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.3.1-py3-none-any.whl (100.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yicloud_sdk_python-0.3.1.tar.gz
  • Upload date:
  • Size: 77.3 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.3.1.tar.gz
Algorithm Hash digest
SHA256 e286762f14cf0f1f84852e756e1d1deb5a51a3ca4d9c902746b05234f07bf79d
MD5 13f4d8574325850afb7bb77fbb995c7c
BLAKE2b-256 aad415a46efd87cbf4943ec0f73249f9b8185fe7127906ff606f406ceb301c07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yicloud_sdk_python-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd0ee4f20311bd6fc42be3aa356b687c10ae74356489f16aeb6f2c75889a9170
MD5 f49ef30e90ca533908b23558314a2f9c
BLAKE2b-256 3aa34eea7d0e6e0d65b1dfd28c970c4336688a34059f604807311ae5e931064b

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