What is this skill
This skill wraps kujiale_upload.py — a self-contained Python script that
validates the complete Kujiale OpenAPI 3D model upload pipeline in exactly 5 steps.
The script uses Python requests / oss2 only, and explicitly disables
environment-derived proxy / certificate overrides (trust_env=False) because
those settings can cause TLS handshake failures in some Windows environments:
| Step | Method | Endpoint | Description |
|---|
| 1 | GET | INLINECODE4 | Obtain OSS STS credentials + INLINECODE5 |
| 2 |
PUT | Alibaba OSS (
oss2) | Upload ZIP bytes to OSS |
| 3 | POST |
/v2/commodity/upload/create | Trigger server-side model parsing |
| 4 | GET |
/v2/commodity/upload/status | Poll parse status until
status == 3 |
| 5 | POST |
/v2/commodity/upload/submit | Submit parsed model → returns
brandGoodId |
Authentication: INLINECODE12
API Key: Apply at Manycore OpenAPI Console
Quick Start
CODEBLOCK0
Prerequisites and Scope
This skill is intended for users who already have:
- - A valid Kujiale OpenAPI
appKey / appSecret — Apply at Manycore OpenAPI Console - Permission to call the commodity model upload APIs in their Kujiale tenant
- A
.zip package that matches Kujiale's 3D model import requirements - Network access to
openapi.kujiale.com and the OSS endpoint returned by Step 1
This repository does not include:
- - Any built-in credentials
- Any guarantee that the generated placeholder ZIP is a production-valid 3D model package
- Any tenant-specific category mapping beyond the sample defaults in INLINECODE17
The auto-generated ZIP is only for API connectivity and workflow smoke testing.
Configuration
Required credentials
You must supply your own Kujiale OpenAPI credentials. There are no built-in defaults.
| Method | How to set |
|---|
| Environment variable (recommended) | INLINECODE18 / INLINECODE19 |
| CLI flag |
--app-key xxx --app-secret xxx |
| Programmatic dict |
run_skill({"app_key": "xxx", "app_secret": "xxx"}) |
Priority: explicit CLI/dict value > environment variable
If credentials are missing, you will see:
CODEBLOCK1
All configuration parameters
| Parameter | Env var / dict key | Default | Description |
|---|
| INLINECODE22 | INLINECODE23 | (required) | Kujiale OpenAPI appKey |
| INLINECODE24 |
KUJIALE_APP_SECRET |
(required) | Kujiale OpenAPI appSecret |
|
zip_path | — |
(auto-generated test ZIP) | Path to the ZIP file to upload |
|
poll_interval | — |
5.0 | Seconds between status polls |
|
poll_timeout | — |
300.0 | Max seconds to wait for parse completion |
|
dry_run | — |
False | If
True, skip all network calls and return mock data |
Transport behavior
- - Default path: API calls use
requests; OSS upload uses INLINECODE35 - The script creates dedicated sessions with INLINECODE36
- This prevents inherited proxy / CA bundle environment settings from breaking TLS handshakes
- If you run this skill inside an agent or IDE that sandboxes outbound network access, the real upload path requires unrestricted network access to
openapi.kujiale.com and the returned OSS endpoint. The script now reports this case explicitly and tells you to rerun with network permissions enabled.
Built-in Step 5 defaults
INLINECODE38 currently submits with these sample defaults:
- - INLINECODE39
- INLINECODE40
These values are not universal. They appear to be business defaults from the original implementation and may be wrong for another tenant or another catalog tree. If your account requires different category metadata, update the script before using the real submit step.
Usage
CLI
CODEBLOCK2
Programmatic (Python)
Import and call run_skill(params) directly:
CODEBLOCK3
Test / Run
What to expect on a successful run
CODEBLOCK4
Parse status codes (Step 4)
| Status | Meaning |
|---|
| 0 | Generating |
| 1 |
Parsing ZIP |
| 2 | ZIP parse failed → raises RuntimeError |
| 3 | ZIP parse success, ready to submit →
proceed to Step 5 |
| 4 | Submit success |
| 5 | Submit task exception → raises RuntimeError |
Common failure modes
| Error | Cause | Fix |
|---|
| INLINECODE42 | No credentials configured | Set KUJIALE_APP_KEY / KUJIALE_APP_SECRET env vars, or pass via --app-key / INLINECODE46 |
| INLINECODE47 |
Invalid appKey/appSecret | Check credentials on Kujiale open platform |
|
FAILED: ZIP file not found: ... | Invalid
--zip path | Pass an existing local
.zip file |
|
FAILED: ZIP file must end with .zip: ... | Wrong file type | Package the model as
.zip before upload |
|
Step 4 poll timeout after 300s | Parse taking too long | Increase
--poll-timeout |
|
Step 4 FAILED: status=2 | Invalid ZIP format | Ensure ZIP contains valid model files |
|
Step 1 request failed: ... /
Step 5 request failed: ... | Network/API connectivity or a local environment override | Check firewall, VPN, DNS, and whether your shell injects custom proxy / CA env vars |
|
outbound network access appears to be blocked by the current runtime or sandbox | The tool is running in a restricted sandbox/agent session | Re-run the same command with unrestricted network access, or allow the agent/tool to escalate network permissions |
|
Step 2 OSS PUT failed: ... | OSS connectivity or STS issue | Check returned OSS region/bucket and network reachability |
Dependencies
CODEBLOCK5
Install:
CODEBLOCK6
Publishing Checklist
Before publishing externally, verify:
- - [ ] No real credentials in any tracked file — run:
grep -rn "app_key\|app_secret" . --include="*.py" --include="*.json" --include="*.md" | grep -v ".env.example" | grep -v "YOUR_APP"
Confirm only placeholder / env-var references remain.
- - [ ]
.env is not committed (keep it local only) - [ ]
.env.example is committed with placeholder values only - [ ] Add
.env to .gitignore in the repo that vendors this skill - [ ] README / SKILL.md directs users to set
KUJIALE_APP_KEY / INLINECODE65 - [ ]
python kujiale_upload.py --dry-run succeeds on a clean machine - [ ]
python kujiale_upload.py without credentials fails with a single-line FAILED: message, not a traceback
Security Notes
- - Credentials are never logged. The script logs
appKey (for traceability) but never logs appSecret or the computed sign. - INLINECODE72 flows only through the in-memory
_sign() function and is never serialised to disk or printed. - STS tokens returned by Step 1 are temporary (short TTL) and scoped to a single upload — no long-lived secrets are stored.
- If you suspect your
appKey/appSecret have been exposed, rotate them immediately on the Manycore OpenAPI Console.
File Tree
CODEBLOCK8
这是什么技能
该技能封装了 kujialeupload.py —— 一个独立的 Python 脚本,能够精确地通过 5 个步骤验证完整的酷家乐 OpenAPI 3D 模型上传流程。该脚本仅使用 Python requests / oss2 库,并明确禁用了环境衍生的代理/证书覆盖(trustenv=False),因为这些设置在某些 Windows 环境中可能导致 TLS 握手失败:
| 步骤 | 方法 | 端点 | 描述 |
|---|
| 1 | GET | /v2/commodity/upload/sts | 获取 OSS STS 凭证 + uploadTaskId |
| 2 |
PUT | 阿里云 OSS (oss2) | 将 ZIP 字节上传到 OSS |
| 3 | POST | /v2/commodity/upload/create | 触发服务端模型解析 |
| 4 | GET | /v2/commodity/upload/status | 轮询解析状态直到 status == 3 |
| 5 | POST | /v2/commodity/upload/submit | 提交已解析的模型 → 返回 brandGoodId |
认证方式:md5(appSecret + appKey + timestamp_ms)
API 密钥:在 Manycore OpenAPI 控制台 申请
快速开始
bash
1. 安装依赖
pip install requests oss2
2. 复制示例环境变量文件并填写您的凭证
cp .env.example .env
Windows PowerShell:
Copy-Item .env.example .env
3. 为当前 Shell 会话设置环境变量
export KUJIALE
APPKEY=your
appkey_here
export KUJIALE
APPSECRET=your
appsecret_here
Windows PowerShell:
$env:KUJIALEAPPKEY=yourappkey_here
$env:KUJIALEAPPSECRET=yourappsecret_here
4. 首先运行安全的本地冒烟测试
python kujiale_upload.py --dry-run
5. 运行真实流程
python kujiale_upload.py
前提条件和适用范围
本技能适用于已具备以下条件的用户:
- - 有效的酷家乐 OpenAPI appKey / appSecret — 在 Manycore OpenAPI 控制台 申请
- 在其酷家乐租户中调用商品模型上传 API 的权限
- 符合酷家乐 3D 模型导入要求的 .zip 包
- 能够访问 openapi.kujiale.com 以及步骤 1 返回的 OSS 端点
本仓库不包含:
- - 任何内置凭证
- 任何保证生成的占位 ZIP 是可用于生产的有效 3D 模型包的承诺
- 除 kujiale_upload.py 中示例默认值之外的任何特定租户分类映射
自动生成的 ZIP 仅用于 API 连通性和工作流冒烟测试。
配置
必需凭证
您必须提供自己的酷家乐 OpenAPI 凭证。没有内置默认值。
| 方法 | 如何设置 |
|---|
| 环境变量 (推荐) | export KUJIALEAPPKEY=xxx / export KUJIALEAPPSECRET=xxx |
| CLI 标志 |
--app-key xxx --app-secret xxx |
| 编程式字典 | run
skill({appkey: xxx, app_secret: xxx}) |
优先级:显式 CLI/字典值 > 环境变量
如果缺少凭证,您将看到:
FAILED: Missing required credentials: appkey (env: KUJIALEAPPKEY), appsecret (env: KUJIALEAPPSECRET).
Set environment variables or pass via --app-key / --app-secret.
See .env.example for reference.
所有配置参数
| 参数 | 环境变量 / 字典键 | 默认值 | 描述 |
|---|
| appkey | KUJIALEAPPKEY | (必需) | 酷家乐 OpenAPI appKey |
| appsecret |
KUJIALE
APPSECRET |
(必需) | 酷家乐 OpenAPI appSecret |
| zip_path | — |
(自动生成的测试 ZIP) | 要上传的 ZIP 文件路径 |
| poll_interval | — | 5.0 | 状态轮询间隔(秒) |
| poll_timeout | — | 300.0 | 等待解析完成的最大秒数 |
| dry_run | — | False | 如果为 True,跳过所有网络调用并返回模拟数据 |
传输行为
- - 默认路径:API 调用使用 requests;OSS 上传使用 oss2
- 脚本创建专用会话,设置 trust_env=False
- 这可以防止继承的代理/CA 包环境设置破坏 TLS 握手
- 如果您在限制出站网络访问的代理或 IDE 中运行此技能,则真实上传路径需要不受限制地访问 openapi.kujiale.com 和返回的 OSS 端点。脚本现在会明确报告此情况,并告诉您启用网络权限后重新运行。
内置步骤 5 默认值
kujiale_upload.py 当前使用以下示例默认值提交:
- - location = 1
- brandCats = [3FO4K6E984C7]
这些值并非通用。它们似乎是原始实现中的业务默认值,对于其他租户或其他目录树可能是错误的。如果您的账户需要不同的分类元数据,请在使用真实提交步骤之前更新脚本。
使用方法
CLI
bash
安装依赖
pip install requests oss2
使用环境变量中的凭证运行(推荐)
python kujiale_upload.py
使用显式凭证运行
python kujiale_upload.py \
--app-key YOUR
APPKEY \
--app-secret YOUR
APPSECRET
使用特定的 ZIP 文件运行
python kujiale_upload.py \
--app-key YOUR
APPKEY \
--app-secret YOUR
APPSECRET \
--zip /path/to/your/model.zip
空运行 — 无需网络调用,无需凭证
python kujiale_upload.py --dry-run
自定义轮询参数
python kujiale_upload.py \
--app-key YOUR
APPKEY \
--app-secret YOUR
APPSECRET \
--poll-interval 3 \
--poll-timeout 120
编程式(Python)
直接导入并调用 run_skill(params):
python
from kujialeupload import runskill
凭证来自环境变量 KUJIALEAPPKEY / KUJIALEAPPSECRET
summary = run_skill({})
print(summary)
{
uploadTaskId: ...,
filePath: ...,
previewImg: ...,
brandGoodId: ...
}
或显式传递凭证
summary = run_skill({
app
key: YOURAPP_KEY,
app
secret: YOURAPP_SECRET,
})
使用特定 ZIP 和覆盖的轮询参数
summary = run_skill({
app
key: YOURAPP_KEY,
app
secret: YOURAPP_SECRET,
zip_path: /path/to/model.zip,
poll_interval: 3.0,
poll_timeout: 120.0,
})
空运行 — 无需网络调用,无需凭证
mock = run
skill({dryrun: True})
print(mock)
{
uploadTaskId: DRYRUNTASK_ID,
filePath: dryrun/path/testmodelforapi_test.zip,
previewImg: ,
brandGoodId: DRYRUNBRANDGOODID,
dry_run: True
}
测试 / 运行
成功运行的预期输出
============================================================
Kujiale OpenAPI Full Flow
appKey=key> zip=testmodelforapi_test.zip
============================================================
[INFO] Created test zip: testmodelforapitest.zip
[Step 1] GET https://openapi.kujiale.com/v2/commodity/upload/sts filename=testmodelforapi_test.zip
[Step 1] OK uploadTaskId=1234567890 filePath=kujiale-models/xxx/testmodelforapitest.zip
[Step 2] OSS PUT endpoint=https://oss-cn-hangzhou.aliyunc