Skip to main content

Unofficial Feishu/Lark Web SDK - WebSocket listener, message search, send, and drive operations

Project description

lark-bridge

Unofficial Feishu/Lark Web SDK using cookie-based authentication. Provides real-time message listening via WebSocket, message search/fetch, sending, and Drive operations.

⚠️ This library is reverse-engineered from Feishu's web client. It is not an official API and may break without notice.

Installation

pip install lark-bridge

Quick Start

import asyncio
from lark_bridge import LarkBridge

bridge = LarkBridge("your_cookie_string_here")

Listen to Messages

async def main():
    async for msg in bridge.listen(watch_chats=["chat_id"]):
        print(f"[{msg['chat_id']}] {msg['from_id']}: {msg['text']}")

asyncio.run(main())

Search History

result = await bridge.search_messages(
    chat_id="7052636707732193282",
    start_time=1716192000,
    end_time=1716278400,
)
print(result["msg_ids"])

Fetch Messages

messages = await bridge.fetch_messages(["msg_id_1", "msg_id_2"])
for msg in messages:
    print(msg["text"])

Send Message

await bridge.send_message(
    chat_id="7052636707732193282",
    text="Hello!",
    reply_id="optional_msg_id",
    at_user_ids=["user_id"],
)

Drive Operations

folder = await bridge.create_folder("My Folder", parent_token="root_token")
result = await bridge.upload_file(folder["token"], "report.txt", b"file content")

Cookie Setup

  1. Open Feishu Web in your browser and log in
  2. Open DevTools (F12) → Application → Cookies
  3. Copy the full cookie string (all key=value pairs joined by ; )
  4. Pass it to LarkBridge("your_cookie_string")

Example cookie format:

cookie = "passport_web_did=YOUR_DID; session=YOUR_SESSION; _csrf_token=YOUR_CSRF_TOKEN"

bridge = LarkBridge(cookie)

Cookie typically stays valid as long as the WebSocket connection is maintained.

License

MIT

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

lark_bridge-0.1.2.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

lark_bridge-0.1.2-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file lark_bridge-0.1.2.tar.gz.

File metadata

  • Download URL: lark_bridge-0.1.2.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lark_bridge-0.1.2.tar.gz
Algorithm Hash digest
SHA256 26a28a7f4449a47d9d8e697b4b2df4f2d30bbc21c8481d2248504565c4623175
MD5 72fd6c43868857acbf1cf4f7409acd85
BLAKE2b-256 24f13e3c612ee6eca9d553e4b5b0be5faf88297d1b89358e5aba1e56157b81c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for lark_bridge-0.1.2.tar.gz:

Publisher: publish.yml on ryanwx/lark-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lark_bridge-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: lark_bridge-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lark_bridge-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6e452ebdd358ca1974da9b33eebaba982dc06f518ad1bbf47ea766b6cb2c7d0
MD5 0745f6ebc418f5893f3028268e7f3167
BLAKE2b-256 daf8197087753d24a7d9ca9d9dd30edb53dd7f77ea78e649540e0efbc7c64458

See more details on using hashes here.

Provenance

The following attestation bundles were made for lark_bridge-0.1.2-py3-none-any.whl:

Publisher: publish.yml on ryanwx/lark-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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