Skip to content

Commit abbf674

Browse files
authored
Add Prowl notification support and update README (#10)
* Add Prowl notification support and update README * Fix syntax error by adding a missing comma in notifications import
1 parent 930c3fc commit abbf674

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ GOTIFY_TOKEN=mytoken
55
GOTIFY_HOST=https://mygotify_server.com
66
NOTIFIERS_TELEGRAM_CHAT_ID=-21xxxxx38
77
NOTIFIERS_TELEGRAM_TOKEN=63xxxxxx71:AAFoxxxxn0hwA-2TVSxxxNf4c
8+
NOTIFIERS_PROWL_API_KEY=xxx

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The application is designed to be run in a Docker container and includes a `ttyd
1515

1616
- Search for appointments by region, specialty, clinic, doctor, date range, and language at a configurable interval.
1717
- Handles Multi-Factor Authentication (MFA).
18-
- Sends notifications via Gotify, Telegram, Pushbullet, Pushover, and XMPP.
18+
- Sends notifications via Gotify, Telegram, Pushbullet, Pushover, Prowl and XMPP.
1919
- Remote management through an integrated `ttyd` web terminal.
2020
- Persistent data storage for sessions, tokens, and logs.
2121
- Bullet proof design - created for long runs.
@@ -180,6 +180,10 @@ Add the required environment variables for your preferred service to the `.env`
180180

181181
- `NOTIFIERS_PUSHBULLET_TOKEN`: Your access token.
182182

183+
### Prowl
184+
185+
- `NOTIFIERS_PROWL_API_KEY`: Your API key.
186+
183187
### XMPP (Jabber)
184188

185189
- `NOTIFIERS_XMPP_JID`: Your full JID (`user@example.com`).

medichaser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
from notifications import (
5959
gotify_notify,
60+
prowl_notify,
6061
pushbullet_notify,
6162
pushover_notify,
6263
telegram_notify,
@@ -910,6 +911,8 @@ def send_notification(
910911
xmpp_notify(message)
911912
elif notifier == "gotify":
912913
gotify_notify(message, title)
914+
elif notifier == "prowl":
915+
prowl_notify(message, title)
913916
log.info("Notification sent successfully.")
914917

915918

notifications.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
pushover = get_notifier("pushover")
2828
telegram = get_notifier("telegram")
2929

30+
def prowl_notify(message: str, title: str | None = None) -> None:
31+
if not environ.get("NOTIFIERS_PROWL_API_KEY"):
32+
print(
33+
"Prowl notifications require NOTIFIERS_PROWL_API_KEY environment to be exported.",
34+
)
35+
return
36+
37+
url = "https://api.prowlapp.com/publicapi/add"
38+
payload = {
39+
"apikey": environ.get("NOTIFIERS_PROWL_API_KEY", ""),
40+
"priority": -1,
41+
"application": title or "MediChaser",
42+
"event": "Alert",
43+
"description": message,
44+
}
45+
try:
46+
response = requests.post(url=url, data=payload, timeout=3)
47+
response.raise_for_status()
48+
except requests.exceptions.RequestException as e:
49+
print(f"Prowl notification failed:\n{e}")
3050

3151
def pushbullet_notify(message: str, title: str | None = None) -> None:
3252
try:

0 commit comments

Comments
 (0)