Skip to main content

AutoFeishu

飞书官方接口的Python封装, 需要自行注册飞书应用

参数配置

本项目使用pydantic_settings读取参数,有多种方法用于设置参数。优先级顺序如下:

  • 代码中设置

    from feishu import config
    config.api_key = 'xxx'
    config.api_secret = 'xx'
    
  • 环境变量(case-insensitive): 所有相关环境变量以FEISHU_开头,例如FEISHU_API_KEY, FEISHU_API_SECRET

  • .feishu.env, .env文件(case-insensitive)

  • pyproject.toml文件(case-sensitive)

    [tool.auto-feishu]
    api_key = "xxx"
    api_secret = "xxx"
    ...
    

配置内容

  • api_key: 飞书应用的App ID
  • api_secret: 飞书应用的App Secret
  • base_url: 飞书API的base url,默认https://open.feishu.cn/open-apis
  • phone, email, open_id: 用于Contact获取默认的用户信息

TODO: 文档https://mkdocstrings.github.io/usage/

当前接口

  • Approval: 创建、同意、拒绝审批,获取审批详情
  • Contact: 根据手机号或邮箱获取open_id
  • Message: 向指定联系人或群发送文本、文件、图片、卡片
  • SpreadSheet: 读写多维表格
  • Group: 群组管理

新增接口开发

继承feishu.client.BaseClient。

  • AuthClient封装了get, post, put, _request等方法,可以自动鉴权发送HTTP请求。
  • AuthClient包含一个使用默认app_id和app_secret的default_client, 可以在classmethod中使用
  • feishu.client.Cache是一个自动区分当前app的描述器,可以用来缓存数据。样例参见feishu.contact.Contact
  • 属性api用于保存各个api的别名和url: {name: /api, ...}

Metadata

Release files for auto-feishu 0.0.15

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

Source distribution (sdist)

Source distribution for auto-feishu 0.0.15
File Size Uploaded Provenance
auto_feishu-0.0.15.tar.gz 23.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for auto-feishu 0.0.15
File Interpreter ABI Platform
auto_feishu-0.0.15-py3-none-any.whl Python 3 none any Details

Total release size: 46.0 kB

Release files / auto_feishu-0.0.15.tar.gz

Download URL auto_feishu-0.0.15.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9ef2ebdccc3dca934c4289abc7b0ec0eaf1659fee464ebc49de16e72895c3d19
BLAKE2b-256 checksum
How to use checksums
8c66a8bbd182e695d65dd2c2c365cb3c0033dcb4eb88081b87f4a37ef1d4b974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Feb 6, 2025.

Transparency log

Release files / auto_feishu-0.0.15-py3-none-any.whl

Download URL auto_feishu-0.0.15-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ace3371807060db30ee51a39bd906a992d0d0669a496caa49febf9e8921d13d3
BLAKE2b-256 checksum
How to use checksums
6f9cdc16b80111e12167d8241d899ca6fbe4ae11da11eeeac6ae0cd21e9f5823
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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 Feb 6, 2025.

Transparency log

Security for auto-feishu 0.0.15

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 auto_feishu-0.0.15.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 Feb 6, 2025.

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.

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