Skip to content

接入 SDK

curl 或 Bruno 验证成功后,再迁移到 SDK。API Client 凭证应保留在后端,并复用已经验证的认证和设备查询流程。

可用 SDK

SDK 当前以源码形式放在 WLTE OpenAPI SDK 仓库中。

语言目录
TypeScriptsdk/typescript
Pythonsdk/python
Gosdk/go
bash
git clone https://github.com/svnwi/wlte-openapi-sdk.git

当前覆盖认证、设备查询、设备类型定义、继电器控制、RS485、设备配置和命令结果查询。

TypeScript

bash
cd wlte-openapi-sdk/sdk/typescript
cp .env.example .env
npm install
npm run example:list-devices
npm run example:list-profiles

Python

bash
cd wlte-openapi-sdk
cp sdk/python/.env.example sdk/python/.env
python3 sdk/python/examples/list_devices.py
python3 sdk/python/examples/list_profiles.py

Go

bash
cd wlte-openapi-sdk/sdk/go
cp .env.example .env
go run ./examples/list_devices
go run ./examples/list_profiles

生产接入检查

  • 从服务端密钥存储读取 clientIdclientSecret
  • 缓存 access token,并在接近 expiresIn 前更新。
  • 根据 HTTP 状态和响应 code 处理结果,不要根据 message 分支。
  • 遵守 Retry-After,重试次数必须有上限。
  • 记录用于排障的 requestId,但不要记录凭证或 token。
  • 需要持续事件时,使用 REST 恢复状态基线,使用 WebSocket 接收实时变化。

下一步

Docs buildVersion v1.3.6-20260720-180213-70
Copyright © 2026 WLTE