添加ifttt推送
This commit is contained in:
parent
6a235de34c
commit
b070102ba5
@ -46,6 +46,12 @@ api_url=http://xxx.xxx.cn
|
|||||||
token=AMxxxx
|
token=AMxxxx
|
||||||
priority=7
|
priority=7
|
||||||
|
|
||||||
|
[ifttt]
|
||||||
|
# If (Receive a web request) Then (Send a rich notification from the IFTTT app)
|
||||||
|
# 使用value1(标题),value2(内容)
|
||||||
|
event=mihoyo_push
|
||||||
|
key=xxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
|
||||||
# 邮件推送
|
# 邮件推送
|
||||||
[smtp]
|
[smtp]
|
||||||
# 一般情况下,465端口会使用ssl加密默认465端口,不加密走25端口。
|
# 一般情况下,465端口会使用ssl加密默认465端口,不加密走25端口。
|
||||||
|
23
push.py
23
push.py
@ -77,6 +77,7 @@ def cqhttp(send_title, push_message):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# smtp mail(电子邮件)
|
# smtp mail(电子邮件)
|
||||||
# 感谢 @islandwind 提供的随机壁纸api 个人主页:https://space.bilibili.com/7600422
|
# 感谢 @islandwind 提供的随机壁纸api 个人主页:https://space.bilibili.com/7600422
|
||||||
def smtp(send_title, push_message):
|
def smtp(send_title, push_message):
|
||||||
@ -170,6 +171,7 @@ def dingrobot(send_title, push_message):
|
|||||||
).json()
|
).json()
|
||||||
log.info(f"推送结果:{rep.get('errmsg')}")
|
log.info(f"推送结果:{rep.get('errmsg')}")
|
||||||
|
|
||||||
|
|
||||||
# 飞书机器人
|
# 飞书机器人
|
||||||
def feishubot(send_title, push_message):
|
def feishubot(send_title, push_message):
|
||||||
api_url = cfg.get('feishubot', 'webhook') # https://open.feishu.cn/open-apis/bot/v2/hook/XXX
|
api_url = cfg.get('feishubot', 'webhook') # https://open.feishu.cn/open-apis/bot/v2/hook/XXX
|
||||||
@ -182,6 +184,7 @@ def feishubot(send_title, push_message):
|
|||||||
).json()
|
).json()
|
||||||
log.info(f"推送结果:{rep.get('msg')}")
|
log.info(f"推送结果:{rep.get('msg')}")
|
||||||
|
|
||||||
|
|
||||||
# Bark
|
# Bark
|
||||||
def bark(send_title, push_message):
|
def bark(send_title, push_message):
|
||||||
rep = http.get(
|
rep = http.get(
|
||||||
@ -203,6 +206,26 @@ def gotify(send_title, push_message):
|
|||||||
).json()
|
).json()
|
||||||
log.info(f"推送结果:{rep.get('errmsg')}")
|
log.info(f"推送结果:{rep.get('errmsg')}")
|
||||||
|
|
||||||
|
# ifttt
|
||||||
|
def ifttt(send_title, push_message):
|
||||||
|
ifttt_event = cfg.get('ifttt', 'event')
|
||||||
|
ifttt_key = cfg.get('ifttt', 'key')
|
||||||
|
rep = http.post(
|
||||||
|
url=f'https://maker.ifttt.com/trigger/{ifttt_event}/with/key/{ifttt_key}',
|
||||||
|
headers={"Content-Type": "application/json; charset=utf-8"},
|
||||||
|
json={
|
||||||
|
"value1": send_title,
|
||||||
|
"value2": push_message
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if 'errors' in rep.text:
|
||||||
|
log.warning(f"推送执行错误:{rep.json()['errors']}")
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
log.info("推送完毕......")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def push(status, push_message):
|
def push(status, push_message):
|
||||||
if not load_config():
|
if not load_config():
|
||||||
|
Loading…
Reference in New Issue
Block a user