Skip to main content

zt-fop-cli

FOP/ARK 接口查询命令行工具,用于登录并搜索接口、查看接口详情与响应说明。

环境要求

  • Python >=3.10
  • 可用浏览器(首次登录会自动打开)

安装

开发安装(源码)

pip install -e .

打包发布

python -m pip install --upgrade build twine
python -m build
twine upload dist/*

快速开始

1) 登录并缓存 Token

首次运行会打开浏览器,请完成登录。成功后会从 localStorage 读取 micro-gosAdmin-Token 并缓存到本地。

# 已有 ZT_SSO_USERNAME / ZT_SSO_PASSWORD 时可无头自动登录
zt-fop-cli login

# 需要输入验证码或手动登录时使用有头模式
zt-fop-cli login --headed

也可跳过手动登录,直接执行 interface search / interface detail; 鉴权失败时会打印原因(含 Token 过期时间),随后自动登录并重试一次。

2) 搜索接口

zt-fop-cli interface search -k 库存

3) 查看接口详情(含响应说明)

zt-fop-cli interface detail 123456

全局参数

  • -o, --output:输出格式,支持:
    • json(默认)
    • human(表格)
  • --version:查看 CLI 版本

示例:

zt-fop-cli -o human interface search -k 订单

说明:interface detail 输出为一个合并对象,包含:

  • interface_detail:接口详情
  • interface_resp:接口响应说明

配置说明

默认配置目录:~/.zt-fop-cli

  • Token 缓存:~/.zt-fop-cli/fop_bearer_token.txt
  • 配置文件:~/.zt-fop-cli/config.yaml

可选配置项示例:

browser_channel: chromium

环境变量(可选)

支持通过环境变量自动填充登录页账号密码(如 SSO 页面字段可用):

  • ZT_SSO_USERNAME
  • ZT_SSO_PASSWORD

未设置时可在浏览器中手动完成登录。

鉴权与自动登录

  • Token 缓存在 ~/.zt-fop-cli/fop_bearer_token.txt,有效期由 JWT 的 exp 决定;过期时命令会明确提示过期时间。
  • 鉴权失败会触发自动登录并重试一次;为避免「每次查询 = 一次密码尝试」把账号锁死:
    • 自动登录前会打印触发原因与登录模式;
    • 连续失败达到 3 次后停止自动登录,需手动执行 zt-fop-cli login --headed。
  • 登录页要求验证码时,无头模式会立即报错并提示改用 login --headed;不会再静默等待。
  • 诊断与进度信息输出到 stderr,stdout 只输出结果 JSON,便于管道解析。

命令一览

  • zt-fop-cli login
    • 浏览器登录并缓存 Token(默认无头;人工登录加 --headed)
  • zt-fop-cli interface search -k <keyword>
    • 模糊搜索接口
  • zt-fop-cli interface detail <interface_id> [--ability 1] [--customer-app-id PLM]
    • 查询接口详情并同时返回响应说明

Metadata

Release files for zt-fop-cli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zt-fop-cli 0.2.0
File Size Uploaded Provenance Actions
zt_fop_cli-0.2.0.tar.gz 14.4 kB Without provenance Details for zt_fop_cli-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zt-fop-cli 0.2.0
File Interpreter ABI Platform Actions
zt_fop_cli-0.2.0-py3-none-any.whl Python 3 none any Details for zt_fop_cli-0.2.0-py3-none-any.whl

Total release size: 27.6 kB

Release files / zt_fop_cli-0.2.0.tar.gz

Download URL zt_fop_cli-0.2.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cc998c78b17fb94319d10830395ce8ba4a28dd4be43e86bf15702c26e58eba9c
BLAKE2b-256 checksum
How to use checksums
bf06d382d4ac110c336fe8f4f256413c741c970c3a9315634d880d49bbb0ce34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / zt_fop_cli-0.2.0-py3-none-any.whl

Download URL zt_fop_cli-0.2.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8d01b75f868e397287e313271bae709ca4222d1617e876572b128ed2d9f7b71
BLAKE2b-256 checksum
How to use checksums
4747e6bab904172f716365d6b69ea10b6aa0095b959a0671635182ab8ee35eeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for zt-fop-cli 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page