Skip to main content

Automation tools for feishu

Project description

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_idapp_secretdefault_client, 可以在classmethod中使用
  • feishu.client.Cache是一个自动区分当前app的描述器,可以用来缓存数据。样例参见feishu.contact.Contact
  • 属性api用于保存各个api的别名和url: {name: /api, ...}

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

auto_feishu-0.0.8.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

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

auto_feishu-0.0.8-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file auto_feishu-0.0.8.tar.gz.

File metadata

  • Download URL: auto_feishu-0.0.8.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for auto_feishu-0.0.8.tar.gz
Algorithm Hash digest
SHA256 790b5a89afe14e8f1dd7b086c0b6a92fec19df46379e051a3278d3c4bfdf4483
MD5 37f4946b160c539538494a8cc4752e7e
BLAKE2b-256 dd1b0d0a801fa537ed50762672d7723c1c50f1c43c66b900e330262d6957fa9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for auto_feishu-0.0.8.tar.gz:

Publisher: publish.yml on Dragon-GCS/AutoFeishu

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

File details

Details for the file auto_feishu-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: auto_feishu-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for auto_feishu-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 29522741f99dab51b5e8ff40a06927be4385a9c2ca89eba5856d57b2c21c7e9c
MD5 1645a1e9532fd682617c46aa50c4c0cb
BLAKE2b-256 6ff43a853133fa21591790da70d3c6fe1bca9bd4303c1d26a7adabf74d7c62a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for auto_feishu-0.0.8-py3-none-any.whl:

Publisher: publish.yml on Dragon-GCS/AutoFeishu

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