Skip to main content

webhook通知命令行工具

Project description

Webhook Cli

  • webhook通知-命令行工具(v2023.3.14)

支持

  • dingtalk (钉钉群机器人)
    • 支持文本 (text)
    • 支持链接 (link)
    • 支持 markdown(markdown)
    • 支持 ActionCard
    • 支持 FeedCard消息类型
  • gitlab
  • coding.net
  • feishu

安装:

  • pip install webhook-cli

功能设计:

> webhook --help

usage: webhook命令行工具 ({__version__})
eg:
  [0] webhook --init_config        ; 初始化配置模板 
  [1] webhook --check_config       ; 检查配置   
  [2] webhook msg.txt              ; text 发送   
  [3] webhook msg.md               ; markdown 发送 
  [4] webhook msg.toml             ; 支持 toml    
  [5] webhook msg.json             ; 支持 json5
  [6] webhook --file msg.json      ; 支持使用形参 --file, 效果同[5], 提高容错
  
  [7] webhook msg.toml --webhook_url https://oapi.dingtalk.com/robot/send?access_token= 
  [8] webhook --webhook_url https://oapi.dingtalk.com/robot/send?access_token= msg.toml 
    ; 效果同[6],提高容错 

## 配置优先级(从高到低往下排):
    0.  --file(toml/json)内置的 options.webhook_url
    1.  --webhook_url 
    2.  进程环境的配置文件( ENV.$WEBHOOK_CONFIG  ) 
    3.  当前工作目录下的 config.toml  
    4.  Ubuntu系统全局默认:$HOME/.config/webhook_cli/config.toml 


## 可选参数
options:
  -h, --help                  ; show this help message and exit
  -v, --version               ; 显示版本号
  -d, --dry_run               ; 不运行,只打印调试参数
  -i, --init_config           ; 生成默认配置(./config.toml)
  -c, --check_config          ; 检查当前的配置
  --webhook_url WEBHOOK_URL   ; 如果设定,将覆盖默认配置的webhook_url
                              
  --file FILE                 ; 必须是可读的文本文件,支持markdown文件(.md); 
                              如果是toml/json,将按照`msgtype`转发; 
                              如果不可识别`msgtype`, 使用raw模式
                              
  --mode MODE                 ; 指定发送模式;如果设置为raw, 则把$file视为text的内容; 
                              默认为auto,如果json/toml内没有指定 msgtype, 则把文件内容序列化

常见的发送错误

// 消息内容中不包含任何关键词
{
  "errcode": 310000,
  "errmsg": "keywords not in content"
}

// timestamp 无效
{
  "errcode": 310000,
  "errmsg": "invalid timestamp"
}

// 签名不匹配
{
  "errcode": 310000,
  "errmsg": "sign not match"
}

// IP地址不在白名单
{
  "errcode": 310000,
  "errmsg": "ip X.X.X.X not in whitelist"
}

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

webhook_cli-2024.4.17.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file webhook_cli-2024.4.17.tar.gz.

File metadata

  • Download URL: webhook_cli-2024.4.17.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for webhook_cli-2024.4.17.tar.gz
Algorithm Hash digest
SHA256 02488f3eb3f99204d7f473e58701af63bed5dbd7305863e4b1e64a0478c434c1
MD5 f52db6b57b3dc4b7d798c4fa0b3d0d74
BLAKE2b-256 23fae3b9ede70f8936ec78d7bfcc224ac8db9b8410b6366638ab596f04152f50

See more details on using hashes here.

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