Files
MediaManager/media_manager/notification/service_providers/pushover.py
Maximilian Dorninger a39e0d204a Ruff enable type annotations rule (#362)
This PR enables the ruff rule for return type annotations (ANN), and
adds the ty package for type checking.
2026-01-06 17:07:19 +01:00

28 lines
986 B
Python

import requests
from media_manager.config import MediaManagerConfig
from media_manager.notification.schemas import MessageNotification
from media_manager.notification.service_providers.abstract_notification_service_provider import (
AbstractNotificationServiceProvider,
)
class PushoverNotificationServiceProvider(AbstractNotificationServiceProvider):
def __init__(self) -> None:
self.config = MediaManagerConfig().notifications.pushover
def send_notification(self, message: MessageNotification) -> bool:
response = requests.post(
url="https://api.pushover.net/1/messages.json",
params={
"token": self.config.api_key,
"user": self.config.user,
"message": message.message,
"title": "MediaManager - " + message.title,
},
timeout=60,
)
if response.status_code not in range(200, 300):
return False
return True