Python - Pushover Notifications

Pushover is an app available for Android and iOS. It allows you to receive push notifications on your phone from your own code. Certain monitoring services such as UptimeRobot support Pushover. Another option is to use email, but I prefer this solution.

1
2
3
4
5
6
7
8
import requests
app_token = 'YOUR_APP_TOKEN'
user_token = 'YOUR_USER_TOKEN'
def alert(title, message, priority='1'):
data = {'token': app_token, 'user': user_token, 'title': title, 'message': message, 'priority': priority}
r = requests.post('https://api.pushover.net/1/messages.json', data=data, headers={'User-Agent': 'Python'})

The API can be found here: https://pushover.net/api