Skip to main content

pylgb

Python versions License: MIT

Lark(A.K.A Feishu) Group Bot Python API - A simple and easy-to-use library for sending messages to Lark group bots.

Features

  • 🤖 Smart Bot - Automatic message type detection
  • 📝 Multiple Message Types - Text, Post, Image, Interactive Card
  • 🔒 Signature Support - HMAC-SHA256 signature verification
  • ✅ Type Hints - Full type annotation support
  • 📦 Minimal Dependencies - Only requires requests

Installation

pip install pylgb

Quick Start

1. Get Webhook URL and Sign Key

  1. Add a custom bot in your Lark group
  2. Copy the webhook URL or just the key (UUID format)
  3. If signature verification is needed, copy the signing key

2. Send Messages

from pylgb import SmartBot

# Without signature
bot = SmartBot("your-webhook-key")

# With signature
bot = SmartBot("your-webhook-key", sign_secret="your-sign-secret")

# Send text message
bot.send("Hello, World!")

# Send text with @mentions
bot.send("Important!", mentioned_list=["ou_xxxx", "@all"])

Usage Guide

Text Message

from pylgb import TextBot

# Without signature
bot = TextBot("your-key")

# With signature
bot = TextBot("your-key", sign_secret="your-sign-secret")
bot.send("Text message", mentioned_list=["ou_xxxx"])

Post (Rich Text) Message

from pylgb import PostBot

content = [
    [{"tag": "text", "text": "Project Weekly Report"}],
    [{"tag": "text", "text": "Progress: 80%"}]
]

bot = PostBot("your-key", sign_secret="your-sign-secret")
bot.send("Weekly Report", content)

Interactive Card

from pylgb import InteractiveBot

card = {
    "header": {"title": {"tag": "plain_text", "content": "Notification"}},
    "elements": [{"tag": "div", "text": {"tag": "plain_text", "content": "Deployed successfully"}}]
}

bot = InteractiveBot("your-key", sign_secret="your-sign-secret")
bot.send(card)

Using SmartBot Auto-Detection

from pylgb import SmartBot

bot = SmartBot("your-key", sign_secret="your-sign-secret")

# Text
bot.send("Text message")

# Image
bot.send({"image_key": "img_xxxx"})

# Card
bot.send({"card": {"header": {...}, "elements": [...]}})

Project Structure

pylgb/
├── src/pylgb/
│   ├── __init__.py       # Entry module
│   ├── _constants.py     # Constants
│   └── bot/
│       ├── __init__.py
│       ├── _abstract.py  # BaseBot class (with signature)
│       ├── _smart.py     # SmartBot
│       ├── text.py       # TextBot
│       ├── post.py       # PostBot
│       ├── image.py      # ImageBot
│       └── interactive.py # InteractiveBot
├── pyproject.toml
├── LICENSE
└── README.md

Development

# Install dev dependencies
pip install -e ".[test]"

# Run tests
pytest --cov=pylgb -v

References

License

MIT License

Metadata

Release files for pylgb 0.1.0

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

Source distribution (sdist)

Source distribution for pylgb 0.1.0
File Size Uploaded Provenance Actions
pylgb-0.1.0.tar.gz 12.0 kB With provenance Details for pylgb-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pylgb 0.1.0
File Interpreter ABI Platform Actions
pylgb-0.1.0-py3-none-any.whl Python 3 none any Details for pylgb-0.1.0-py3-none-any.whl

Total release size: 25.6 kB

Release files / pylgb-0.1.0.tar.gz

Download URL pylgb-0.1.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bef98ad86084c43f68d72416067599559d23d28d3047efa94362ca0a3b51a7f0
BLAKE2b-256 checksum
How to use checksums
d3a27dfb972bc2f7cd9f75aefe27e6211f6efc955b4c69b4139a1d47c35f1cec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release files / pylgb-0.1.0-py3-none-any.whl

Download URL pylgb-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ca356a1074bc487067c88b2abcaf9513986859cec67921c96b013e34f460a8e
BLAKE2b-256 checksum
How to use checksums
b0010e4d80f8825788fc190185faa9a5e2a8f0f0d60c4ed5ebfcebd89131c9f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Security for pylgb 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pylgb-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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