# openapi-sdk-python **Repository Path**: yicloud-team/openapi-sdk-python ## Basic Information - **Project Name**: openapi-sdk-python - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2026-05-14 - **Last Updated**: 2026-09-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenAPI SDK for Python A Python SDK for the OpenAPI service. ## Installation 使用 pip 安装(推荐): ```bash 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 ```python 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` | 9 | 文件系统 FS | | IAM | `yicloud.services.iam` | 12 | 访问控制 IAM | | Inferset | `yicloud.services.inferset` | 21 | 模型推理服务 INFERSET | | JOB | `yicloud.services.job` | 13 | 训练任务 JOB | | MC | `yicloud.services.mc` | 29 | 管理中心 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` | 9 | 镜像仓库 REGISTRY | | Sandbox | `yicloud.services.sandbox` | 19 | 沙盒 SANDBOX | | Volume | `yicloud.services.volume` | 12 | 云盘管理 Volume | | Workspace | `yicloud.services.workspace` | 20 | 开发机 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 (15 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 ├── sandbox/ # 沙盒 SANDBOX ├── volume/ # 云盘管理 Volume ├── workspace/ # 开发机 WS examples/ # Example code (one per service) ```