Lark OpenAPI SDK for Python
Project description
飞书开放接口SDK/Feishu OpenPlatform Server SDK
旨在让开发者便捷的调用飞书开放API、处理订阅的事件、处理服务端推送的卡片行为等。
Feishu Open Platform offers a series of server-side atomic APIs to achieve diverse functionalities. However, actual coding requires additional work, such as obtaining and maintaining access tokens, encrypting and decrypting data, and verifying request signatures. Furthermore, the lack of semantic descriptions for function calls and type system support can increase coding burdens.
To address these issues, Feishu Open Platform has developed the Open Interface SDK, which incorporates all lengthy logic processes, provides a comprehensive type system, and offers a semantic programming interface to enhance the coding experience.
介绍文档 Introduction Documents
- 开发前准备(安装) / Preparations before development(Install SDK)
- 调用服务端 API / Calling Server-side APIs
- 处理事件订阅 / Handle Events
- 处理卡片回调 / Handle Card Callbacks
- 常见问题 / SDK FAQs
扩展示例
我们还基于 SDK 封装了常用的 API 组合调用及业务场景示例,如:
- 消息
- 通讯录
- 多维表格
- 电子表格
- 教程
更多示例可参考:https://github.com/larksuite/oapi-sdk-python-demo
Channel module
lark_oapi.channel is a higher-level capability layer on top of the core
OpenAPI client. It wraps event subscription, message normalization, outbound
sending, streaming card updates, deduplication, retries, and SSRF-guarded
media uploads behind a single FeishuChannel class — so a working bot is
only a handful of lines.
Install
pip install lark-oapi
Quickstart — echo bot
import asyncio
from lark_oapi.channel import FeishuChannel
channel = FeishuChannel(app_id="cli_xxx", app_secret="***")
@channel.on("message")
async def on_message(msg):
await channel.send(
msg.conversation.chat_id,
{"text": f"echo: {msg.content_text}"},
)
asyncio.run(channel.connect())
channel.connect() opens a long-lived WebSocket to Feishu, dispatches inbound
events through registered on(...) handlers, and keeps the connection alive
across reconnects. channel.send(...) accepts plain dicts ({"text": ...},
{"markdown": ...}, {"card": ...}) or strongly-typed Outbound* payloads
from lark_oapi.channel.
See the Channel quickstart,
Channel reference,
and Channel echo bot sample
for runnable usage and API details. The public surface is exported from
lark_oapi.channel.
Requirements
Python >= 3.8
License
MIT
加入交流互助群
单击或扫码加入讨论群
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
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 lark_oapi-1.6.1.tar.gz.
File metadata
- Download URL: lark_oapi-1.6.1.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34d0594464e37c5a5ffbb398a567f8f3c608d6f49496b828a897233f094cc067
|
|
| MD5 |
a75fc2edc41204bf0be7d81e125182d8
|
|
| BLAKE2b-256 |
93e289665d999a87ee1947bfd9109ff17c5259020293958d85ac0eef1f2e14f0
|
File details
Details for the file lark_oapi-1.6.1-py3-none-any.whl.
File metadata
- Download URL: lark_oapi-1.6.1-py3-none-any.whl
- Upload date:
- Size: 7.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
faa91fe7de809dbdb5eb8d81604c96eaba4da9e36d1fdbbd10a47bff7e010bf3
|
|
| MD5 |
8a69f0d3335eff123348a37902fcaf0b
|
|
| BLAKE2b-256 |
0a8e53451b915a806506b4838c81ff76dfb637e2f6615a1c9016fe9ebd6af5b5
|