I-Search Agent RPA Python SDK,封装 OCR、验证码、DocAgent、VNC 等客户端能力
Project description
isa-rpa
I-Search Agent RPA Python SDK,封装 OCR、验证码、DocAgent、浏览器会话、凭据等客户端能力。
该包可从官方 PyPI 安装,但其中部分能力依赖 I-Search 内部运行环境、内部网关或平台侧注入的环境变量。公开安装不等于脱离这些运行条件即可直接使用。
安装
如果使用方没有修改 uv 的默认索引,可以直接从官方 PyPI 安装:
uv add isa-rpa
作为 CLI 工具安装:
uv tool install isa-rpa
也可以使用 pip:
pip install isa-rpa
打包与发布
本模块位于 monorepo rpa-code-agent/sdk/isa-rpa/。
uv build --no-sources
uv publish
构建产物位于 dist/ 目录:
dist/isa_rpa-0.1.2-py3-none-any.whl
dist/isa_rpa-0.1.2.tar.gz
CLI
查看帮助:
isa-rpa --help
如果在魔术师环境中运行,通常需要由运行时注入 ISA_RUNTIME=magician、CLIENT_ID 以及网关相关环境变量。
Python SDK
浏览器会话
统一的 Playwright 浏览器入口,自动处理魔术师环境(连接已有 CDP)与本地开发环境(首次会启动有头浏览器并在 {cwd}/.cache/isa-rpa/chromium-profile/ 保留登录态)。本地启动时按优先级解析可执行文件:用户系统已安装的 Google Chrome → Playwright 自带的 Chromium;都没有则提示安装 Chrome 或执行 uv run playwright install chromium。
import asyncio
from isa_rpa import BrowserSession
async def main():
async with BrowserSession() as context:
page = context.pages[0] if context.pages else await context.new_page()
await page.goto("https://example.com")
print(await page.title())
asyncio.run(main())
退出 async with 时由 SDK 自行决定是否关闭浏览器:
- 通过 CDP 连接的共享浏览器不关
- 本地兜底启动的 Chromium 会被关掉,避免子进程泄漏
凭据管理
from isa_rpa import CredentialClient
client = CredentialClient()
items = client.list()
detail = client.query(name="测试凭据")
# 排查非魔术师环境下的 token / header / 请求体 / 响应内容时可打开调试输出
debug_client = CredentialClient(debug=True)
debug_client.query(name="测试凭据")
CLI 下也可以通过环境变量开启同样的调试打印:
ISA_RPA_CREDENTIAL_DEBUG=1 isa-rpa credential query --name 测试凭据
DocAgent
from isa_rpa import DocAgentClient
client = DocAgentClient(token="your-token")
files = client.list_files(project_code="PRJ001")
bills = client.list_bills(project_code="PRJ001")
验证码识别
from isa_rpa import CaptchaClient
client = CaptchaClient(
api_key="your-api-key",
secret_key="your-secret-key",
)
适用范围
- OCR、验证码识别等能力可按各自接口配置独立使用。
- 浏览器会话、凭据、DocAgent、统一 token 获取等能力通常依赖 I-Search 平台环境,但
BrowserSession在没有平台环境时会自动 fallback 到本地启动 Chromium,可用于纯本地开发。 - 若你的运行环境不提供对应的网关、认证或共享组件,这些能力可能无法直接工作。
开发
uv sync
uv run pytest
uv run ruff check src/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file isa_rpa-0.2.0-py3-none-any.whl.
File metadata
- Download URL: isa_rpa-0.2.0-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
424f53d0f7496e50b0e1a054e7e49aafecc21d77dcfc52becb05dcae45e7f8c6
|
|
| MD5 |
ef8a00de1d5e0c67d382001c382a0697
|
|
| BLAKE2b-256 |
a5e5dfe6a43ffd09c88d53b5ea2ae20b17dbae4ddb4213fcb31e93e056d89745
|