这是一个用于向企业微信机器人推送消息的 Python 工具,支持通过命令行参数或环境变量传递配置。
secret 和 message。\t(制表符),可以通过参数或环境变量覆盖。将项目打包为 Docker 镜像:
docker build -t wechat-notifier .
docker run --rm \
wechat-notifier \
-s "your_secret_key" \
-m "Hello, this is a test message!"
docker run --rm \
-e SECRET="your_secret_key" \
-e MESSAGE="Hello, this is a test message!" \
wechat-notifier
命令行参数的优先级高于环境变量:
docker run --rm \
-e SECRET="env_secret" \
-e MESSAGE="env_message" \
wechat-notifier \
-s "cli_secret" \
-m "cli_message"
| 参数名 | 环境变量名 | 说明 | 是否必填 | 默认值 |
|---|---|---|---|---|
-s, --secret | SECRET | 企业微信机器人的 secret 密钥 | 是 | 无 |
-m, --message | MESSAGE | 要发送的消息内容 | 否 | \t |
. ├── Dockerfile # Docker 镜像构建文件 ├── main.py # 主程序脚本 └── README.md # 项目说明文档
本项目基于 MIT 许可证开源。