跳转到内容
彼岸论坛
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[分享创造] 自己写的消息推送的 Python 库


小天管理

已推荐帖子

之前用过很多种消息推送的工具,比如企业微信、IYUU 、钉钉、Server 酱、GNotify 、Ntfy 等,所以就用 Python 写了个消息推送的小工具在项目的其他地方能快速调用发送消息,其实就是网络请求调用了一下官方提供的 API 。

目前简单支持了企业微信、飞书、钉钉、Gotify 、Ntfy 、Server 酱、IYUU 、AnPush 、息知、传息、WPush 、PushPlus 、TG Bot 、Email ,还挺不完善的。

项目地址: https://github.com/TommyMerlin/ANotify

还是纯新手😶

  • 安装
pip install anotify

统一的调用格式:

  • 企业微信
from ANotify import Nwecom
# 企业 ID
CORPID = ''
# 应用 Secret
CORPSECRET = ''
# 应用 ID
AgentId = ''

wn = Nwecom.WxNotify(corpid=CORPID, corpsecret=CORPSECRET, agentid=AgentId)
wn.send_msg("test message")
wn.send_msg_markdown("**Hello**\n- test1\n- [ANotify]( https://github.com/TommyMerlin/ANotify)")
wn.send_text_card("test title", "test content", "https://www.example.com")
wn.send_file("./test.txt")
wn.send_img("./test.png")
  • Gotify
from ANotify import Ngotify
TOKEN = ""
SERVER_URL = ""
gotify = Ngotify.GotifyNotify(SERVER_URL, TOKEN)
gotify.send_msg("title", "content")
gotify.send_msg("title", "**content**\n- No.1\n- No.2", Ngotify.MessageType.markdown)
  • Ntfy
from ANotify import Nntfy
TOPIC = ""
URL = ""
ntfy = Nntfy.NtfyNotify(TOPIC, URL)
ntfy.send_msg("title", "content")
  • AnPush
from ANotify import Nanpush
TOKEN = ""
anpush = Nanpush.AnpushNotify(TOKEN)
anpush.send_msg("title", "content", "channel_id")

其余的就不一一写了

意见的链接
分享到其他网站

加入讨论

您现在可以发表并稍后注册. 如果您是会员,请现在登录来参与讨论.

游客
回复主题...

×   粘贴为富文本.   粘贴为纯文本来代替

  只允许使用75个表情符号.

×   您的链接已自动嵌入.   显示为链接来代替

×   您之前的内容已恢复.   清除编辑器

×   您无法直接粘贴图片.要从网址上传或插入图片.

  • 游客注册

    游客注册

  • 会员

    没有会员可显示

  • 最新的状态更新

    没有最新的状态更新
  • 最近查看

    • 没有会员查看此页面.
×
×
  • 创建新的...