Skip to main content

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]

运行时依赖:

  • node
  • npm

首次调用 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


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.0b2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nim_bot_py-0.1.0b2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file nim_bot_py-0.1.0b2.tar.gz.

File metadata

  • Download URL: nim_bot_py-0.1.0b2.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nim_bot_py-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 fb83667cd0db15bb51afd1d8f3b3b4b4e0359a3e09dbd848968673ede4f67e9c
MD5 458ae210a3d3f39dd6036a5f2c77f854
BLAKE2b-256 e970e7818b58fd4d26e34696a380d5ffc3c9768cc819ab505f32b03790bfda38

See more details on using hashes here.

File details

Details for the file nim_bot_py-0.1.0b2-py3-none-any.whl.

File metadata

  • Download URL: nim_bot_py-0.1.0b2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nim_bot_py-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e14c5628b3bbc02c3ae442e9d310eec129b13ef4dab9f7cfb4b96fc7a9fa8a0
MD5 ee54c2976afdd7f02255688c37059fc3
BLAKE2b-256 1dec4ca6bc7996c7775fdfe02feb0607763e472bf0b7181d7c49343e83900689

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page