You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
traktarr/notifications/apprise.py

33 lines
779 B

import apprise
from misc.log import logger
log = logger.get_logger(__name__)
class Apprise:
NAME = "Apprise"
def __init__(self, url, title='Traktarr'):
self.url = url
self.title = title
log.debug("Initialized Apprise notification agent")
def send(self, **kwargs):
if not self.url:
log.error("You must specify a URL when initializing this class")
return False
# send notification
try:
apobj = apprise.Apprise()
apobj.add(self.url)
apobj.notify(
title=self.title,
body=kwargs['message'],
)
except Exception:
log.exception("Error sending notification to %r", self.url)
return False