Below is my python script to push messages via pushover to my phone.
It’s being run from a cron during the day.
CODE
import csv import datetime import requests # configure own creds PUSHOVER_USER_KEY = 'keykeykeykeykeykeykeykey' PUSHOVER_API_TOKEN = 'tokentokentokentokentokentokentoken' CSV_FILE = '/data/notifications.csv' def send_pushover_notification(message): url = "https://api.pushover.net/1/messages.json" payload = { "token": PUSHOVER_API_TOKEN, "user": PUSHOVER_USER_KEY, "message": message } response = requests.post(url, data=payload) if response.status_code != 200: print("Failed to send notification:", response.text) def check_and_notify(): today = datetime.date.today() with open(CSV_FILE, newline='') as csvfile: reader = csv.DictReader(csvfile) for row in reader: try: day = int(row['day']) month = int(row['month']) if today.day == day and today.month == month: send_pushover_notification(row['message']) except ValueError: continue if __name__ == "__main__": check_and_notify()
notifications.csv file
day,month,message 1,1,Birthday of a new year 16,05,Project Deadline 16,05,Test2 (blah) 2 7,3,Glorious bastard Rik Mayall birthday 27,3,International whisky day
Nice to haves (didn’t implement because i’m a lazy bastard)
- 3rd Saturday every may
- Getting dates or updates from another app
- Selecting Pushover device, level of alertness .. etc