PyComicPackRouMan/utils/Ntfy.py
2023-02-12 13:41:14 +08:00

19 lines
549 B
Python

import requests,time
class ntfy:
@classmethod
def sendMsg(cls, msg,alert=True,sleep=None,error=None):
try:
print(f"#ntfy: {msg}")
if alert:
requests.post("https://ntfy.caiwenxiu.cn/PyComic",
data=msg.encode(encoding='utf-8'))
except:
print(f"#ntfy error: {msg}")
if sleep != None:
time.sleep(int(sleep))
if error != None:
print(f"#ntfy Error: {error}")
return False
else:
return True