Skip to content

Instantly share code, notes, and snippets.

@hongta
Last active June 1, 2018 02:16
Show Gist options
  • Select an option

  • Save hongta/e72c82bb3275d1a8fc3d1bb82eadf77a to your computer and use it in GitHub Desktop.

Select an option

Save hongta/e72c82bb3275d1a8fc3d1bb82eadf77a to your computer and use it in GitHub Desktop.
[pushover]
# source: http://forums.fast.ai/t/training-metrics-as-notifications-on-mobile-using-callbacks/17330
def send_notification(msg_string):
'''
This function sends message to my mobile using Pushover.
'''
import requests
from datetime import datetime
url = "https://api.pushover.net/1/messages.json"
data = {
'user' : "<<YOUR_USER>",
'token' : "<<YOUR_TOKEN>>",
'sound' : "gamelan"
}
data['message'] = msg_string
data['message'] = data['message'] + "\n" + str(datetime.now())
r = requests.post(url = url, data = data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment