Skip to main content

larkify

license pypi python pyright ruff

现代、完整类型标注的飞书 / Lark Python SDK

文档 | 反馈问题 | 飞书开放平台

  • 同步 / 异步同一套 API,所有接口都有 create 与 async_create 两种形式
  • 覆盖 1753 个服务端 API、205 个事件,代码由开放平台元数据生成
  • 从参数到响应完整类型标注,TypedDict 校验入参字典,pydantic 校验请求体与响应
  • token 自动获取、缓存、失效重取,refresh_token 轮换并发安全
  • 限流与服务端错误自动重试,且不会重放非幂等请求
  • 事件订阅支持 Webhook 和长连接,后者直接使用 httpx2 的 WebSocket,不依赖 protobuf
  • 按需加载,import larkify 约 60ms

快速开始

更多内容见文档。

安装

需要 Python 3.11+(来自 httpx2 的要求)。

pip install larkify

pip install "larkify[crypto]"  # 解密加密事件
pip install "larkify[ws]"      # 长连接
pip install "larkify[redis]"   # 多进程共享 token 缓存
pip install "larkify[all]"

使用

from larkify import AppAuthStrategy, Feishu

feishu = Feishu(AppAuthStrategy("cli_xxx", "app_secret"))

resp = feishu.rest.im.v1.message.create(
    receive_id_type="open_id",
    receive_id="ou_xxx",
    msg_type="text",
    content='{"text": "你好"}',
)
print(resp.parsed_data.message_id)


async def main() -> None:
    resp = await feishu.rest.im.v1.message.async_create(
        receive_id_type="open_id",
        receive_id="ou_xxx",
        msg_type="text",
        content='{"text": "你好"}',
    )
    print(resp.parsed_data.message_id)

调用路径是 feishu.rest.<业务域>.<版本>.<资源>.<方法>,与官方 SDK 的 client.im.v1.message.create 一一对应。

开发

见贡献指南。

License

MIT。部分代码源自 githubkit 和 oapi-sdk-python,其许可声明见 NOTICE。

Metadata

Release files for larkify 0.2.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 larkify 0.2.0
File Size Uploaded Provenance Actions
larkify-0.2.0.tar.gz 1.1 MB With provenance Details for larkify-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.2 MB

Release files / larkify-0.2.0.tar.gz

Download URL larkify-0.2.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
85ef301933da02d86e1c15dca19b98ca97e3beacd83e6dc476937def87e31b27
BLAKE2b-256 checksum
How to use checksums
783c4c86b9ac9eb00ce98971aa5a16c7a47b4d12725bf1a7bcf8b38cd183363d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 7, 2026.

Transparency log

Release files / larkify-0.2.0-py3-none-any.whl

Download URL larkify-0.2.0-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a4f557e781e4860c476263ac13050264cacbd99ad0776f038eec928207766b12
BLAKE2b-256 checksum
How to use checksums
02754c7b205d90e693dcb0c0439bff1b4b91fab791ba978703c1f07bb73c0b6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 7, 2026.

Transparency log

Security for larkify 0.2.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for larkify-0.2.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 Nov 7, 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.2.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