Files
Sebastian Goscik bbd70f49bf ruff format
2024-08-09 23:43:03 +01:00

19 lines
540 B
Python

"""A 'singleton' module for registering apprise notifiers."""
import apprise
notifier = apprise.Apprise()
def add_notification_service(url):
"""Add apprise URI with support for tags e.g. TAG1,TAG2=PROTOCOL://settings."""
config = apprise.AppriseConfig()
config.add_config(url, format="text")
# If not tags are specified, default to errors otherwise ALL logging will
# be spammed to the notification service
if not config.servers()[0].tags:
config.servers()[0].tags = {"ERROR"}
notifier.add(config)