Skip to main content

wps365 — WPS365 全域业务 API Python 绑定

WPS365 云文档工具(wps365-rs)的 Python 绑定:基于 PyO3 将核心库编译为 CPython 扩展模块,提供云盘文件与智能文档修改/导出、待办、组织架构、知识库、日历日程、邮箱、消息、会议、审批、传统/智能/多维表格等全域能力的同步 Python API。

CLI 与桌面 GUI 用法见仓库根 README,本页仅覆盖 Python 绑定。

安装

pip install wps365        # 或 uv pip install wps365

已发布至 PyPI:CDYLIB 扩展,无 Python 侧运行时依赖。

源码构建(开发用)

# 仓库根目录:uv 管理的 venv + maturin
uv venv .venv --python 3.13
uv pip install --python .venv maturin

# 构建并安装到 venv(editable,改 Rust 代码后重复执行即可)
cd crates/wps365-python
VIRTUAL_ENV=<仓库根>/.venv ../../.venv/Scripts/maturin develop

# 或只出分发物
uv build --wheel

快速上手

from wps365 import Client, Wps365Error

client = Client()                     # 凭据解析:构造参数 > 环境变量 > 配置文件
# client = Client(sid="V02S...")      # 也可直接传入 wps_sid

for item in client.search("季度报告"):
    print(item["name"], item["link_url"])

result = client.upload(r"D:\报告.xlsx", folder="项目文档", share=True)
info = client.download(result["file_id"], dest="./下载")
text = client.read(result["file_id"])["markdown"]    # 在线文档抽取正文

Client 平铺全部 230 个方法(认证 / 云盘 / 文件 / 智能文档 / 待办 / 组织 / 知识库 / 日历 / 邮箱 / 消息 / 会议 / 审批 / 表格三件套 / 搜索 / 收藏 / 回收站 / 评论 / 标签),完整签名见随包分发的 wps365.pyi(IDE 自动补全开箱可用)。所有方法为同步阻塞调用,执行期间释放 GIL;返回值为 openapi 原始响应序列化而来的 dict / list / str。

凭据

优先级(首个非空者生效):构造参数 sid > 环境变量 WPS_SID > wps_sid > COOKIE(解析其中 wps_sid 字段)> 配置文件 auth_state.wps_sid。

获取 wps_sid:浏览器登录 kdocs.cn → F12 → Application → Cookies → 复制 wps_sid 值。

错误处理

全部错误以 Wps365Error(Exception 子类)抛出,消息格式为「[机器错误码] 描述」,错误码与 CLI 一致(AUTH_EXPIRED_NO_SID / INVALID_PARAM / API_ERROR / IO_ERROR 等),可按前缀分支处理。

静态检查

  • mypy / Pyright(Pylance):开箱即用,读取随包分发的 wps365.pyi。
  • Pylint:默认不导入 C 扩展,会对 wps365.Client 等成员误报 no-member(E1101),需在使用方项目放行:
# 使用方项目的 pyproject.toml(或同目录 .pylintrc)
[tool.pylint.main]
extension-pkg-allow-list = ["wps365"]

测试

cd crates/wps365-python
../../.venv/Scripts/python.exe -m pytest tests/ -v                        # 离线冒烟
WPS365_PYTHON_LIVE=1 ../../.venv/Scripts/python.exe -m pytest tests/ -v   # 含真实 API 用例

License

MIT

Metadata

Release files for wps365 0.5.1

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

Source distribution (sdist)

Source distribution for wps365 0.5.1
File Size Uploaded Provenance Actions
wps365-0.5.1.tar.gz 116.2 kB Without provenance Details for wps365-0.5.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for wps365 0.5.1
File Actions
wps365-0.5.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for wps365-0.5.1-cp313-cp313-win_amd64.whl
wps365-0.5.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for wps365-0.5.1-cp312-cp312-win_amd64.whl
wps365-0.5.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for wps365-0.5.1-cp311-cp311-win_amd64.whl
wps365-0.5.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for wps365-0.5.1-cp310-cp310-win_amd64.whl
wps365-0.5.1-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for wps365-0.5.1-cp39-cp39-win_amd64.whl

Total release size: 20.5 MB

Release files / wps365-0.5.1.tar.gz

Download URL wps365-0.5.1.tar.gz
Size 116.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a6454caa7816781fa59f8a0ee35e37ab72193131172a609d5e00cb505ca06199
BLAKE2b-256 checksum
How to use checksums
b8b35a0a5bdb72c37e5941e695e67c1bd0f250878c2177f74ab790e96ccc05ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wps365-0.5.1-cp313-cp313-win_amd64.whl

Download URL wps365-0.5.1-cp313-cp313-win_amd64.whl
Size 4.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
7016a9e9f8d1da6c21e2a1960dc000979e4fe752c1ed90196327d3fe74cd0862
BLAKE2b-256 checksum
How to use checksums
8081c52bb81773cf087e2f0c5c78e34c35a306c600c7058ad03b0b45377e61ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wps365-0.5.1-cp312-cp312-win_amd64.whl

Download URL wps365-0.5.1-cp312-cp312-win_amd64.whl
Size 4.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
d4441e1ef3db278539b2c942f049fbc7442d64a0358c3b072efef4e0f90d6af0
BLAKE2b-256 checksum
How to use checksums
5f0971d3b36647c7935bc38f4b1d274445b576986c260637e2037ff577699430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wps365-0.5.1-cp311-cp311-win_amd64.whl

Download URL wps365-0.5.1-cp311-cp311-win_amd64.whl
Size 4.1 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
cab790358adcc61e797e5b4bf206fff477c3616be6b40bb43032cafac11877e0
BLAKE2b-256 checksum
How to use checksums
f7cc8d1ee1d9a586e076b26a1857c046ff864a88da3851062c68f395c50955fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wps365-0.5.1-cp310-cp310-win_amd64.whl

Download URL wps365-0.5.1-cp310-cp310-win_amd64.whl
Size 4.1 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
ea1921b7ce440be89f8126bba792810bdbe4ad619969eb03278b947acaddbf46
BLAKE2b-256 checksum
How to use checksums
bd835c94466e7744ddde7617193a0c62f55e37692ebb5ba5bb55f55eba59db98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wps365-0.5.1-cp39-cp39-win_amd64.whl

Download URL wps365-0.5.1-cp39-cp39-win_amd64.whl
Size 4.1 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
1949143b85d4ca1025499e5d7f759c7b2d88014233a36a73ab5af1473c20515a
BLAKE2b-256 checksum
How to use checksums
be27e66917bd5112c8d3838cc3e75cadbf30d3a77536e61c555a4fa823089057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for wps365 0.5.1

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