Thin Python wrapper around @yxim/nim-bot via a local Node bridge
Project description
nim-bot-py
nim-bot-py 是 @yxim/nim-bot 的轻量 Python 封装。
项目保持明确的职责边界:
- Node.js 负责 NIM SDK 运行时
- Python 负责配置、路由、重试与业务集成
安装
pip install -e .[dev]
运行时依赖:
nodenpm
首次调用 connect() 时,会自动将 @yxim/nim-bot 安装到内置的 bridge 目录中。
示例
import asyncio
from nim_bot_py import NimClient, NimCredentials
async def main() -> None:
client = NimClient(
credentials=NimCredentials(
app_key="your-app-key",
account="your-bot-account",
token="your-token",
),
debug=True,
)
client.on_message(lambda message: print(message.text))
await client.connect()
await client.send_text("user:123456", "hello from python")
asyncio.run(main())
API 概览
NimClient:单个 NIM 实例MultiNimClient:支持路由的多实例封装NodeBridge:底层 JSONL 桥接客户端
核心方法:
connect()disconnect()health()send_text()ack_message()mark_conversation_read()
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 Distribution
nim_bot_py-0.1.0b1.tar.gz
(13.6 kB
view details)
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 nim_bot_py-0.1.0b1.tar.gz.
File metadata
- Download URL: nim_bot_py-0.1.0b1.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e57457ada9f6159de28d6a2f66269f4e5d692b4752048dfd8136dff21cabce2a
|
|
| MD5 |
d2e127cb844e18248f3217c9b410df78
|
|
| BLAKE2b-256 |
4adb20cb7645ec5cc8fc6de8492176b8f96769b34c3e0f072e2ce1ac1c91d33e
|
File details
Details for the file nim_bot_py-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: nim_bot_py-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f2375d607cccc09984a6660e008bb7b68b11d17299a780335239869f7e905ca
|
|
| MD5 |
2370e76ca81813488a1e3c0cde59161a
|
|
| BLAKE2b-256 |
15c7cd168f92c55de5162d38f062a94f22f7456fdbc7ce39e2a53cb5e400a5a6
|