24 lines
652 B
Python
24 lines
652 B
Python
import requests
|
|
|
|
|
|
class Gotify:
|
|
def __init__(self, token: str):
|
|
self._token = token
|
|
self._url = f"https://gotify.lennartalff.net/message?token={self._token}"
|
|
|
|
def send(self, priority: int, title: str, text: str):
|
|
return requests.post(
|
|
self._url,
|
|
json={
|
|
"message": text,
|
|
"priority": priority,
|
|
"title": title,
|
|
},
|
|
)
|
|
|
|
def send_info(self, title="", text=""):
|
|
return self.send(priority=5, title=title, text=text)
|
|
|
|
def send_error(self, title="", text=""):
|
|
return self.send(priority=10, title=title, text=text)
|
|
|