Implement notifications
parent
f4772a3c7d
commit
4c463e88f2
@ -0,0 +1,23 @@
|
||||
import requests
|
||||
from django.conf import settings
|
||||
|
||||
from core.util import logs
|
||||
|
||||
NTFY_URL = "https://ntfy.sh"
|
||||
|
||||
log = logs.get_logger(__name__)
|
||||
|
||||
|
||||
def sendmsg(msg, title=None, priority=None, tags=None):
|
||||
headers = {"Title": "Fisk"}
|
||||
if title:
|
||||
headers["Title"] = title
|
||||
if priority:
|
||||
headers["Priority"] = priority
|
||||
if tags:
|
||||
headers["Tags"] = tags
|
||||
requests.post(
|
||||
f"{NTFY_URL}/{settings.NOTIFY_TOPIC}",
|
||||
data=msg,
|
||||
headers=headers,
|
||||
)
|
Loading…
Reference in New Issue