Skip to content

Instantly share code, notes, and snippets.

@Swop
Created March 14, 2016 19:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swop/3274522353919d599df1 to your computer and use it in GitHub Desktop.
Save Swop/3274522353919d599df1 to your computer and use it in GitHub Desktop.
Check Domino's pizza delivery status and push an OSX notification after each status change. Yummy
import json
import urllib2
import sys
import time
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
orderId = sys.argv[1]
step = previousStep = None
while True:
data = json.load(urllib2.urlopen('https://commande.dominos.fr/eStore/fr/Tracker/GetOrderStatus?orderId='+orderId))
step = data['MediaItems'][0]['Text']
if (step != previousStep):
notification = NSUserNotification.alloc().init()
notification.setTitle_("Dominos")
notification.setInformativeText_(step)
notification.setSoundName_(NSUserNotificationDefaultSoundName)
center = NSUserNotificationCenter.defaultUserNotificationCenter()
center.deliverNotification_(notification)
previousStep = step
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment