License MIT license
Lines 54
Keywords
dominos (1) pizza (1) xml (4)
Permissions
Viewable by Everyone
Editable by All Siafoo Users
Hide
Stay up to dateembedded code automagically updates, each snippet and article has a feed Join Siafoo Now or Learn More

Domino's Delivery Status! Atom Feed 0

In Brief All you have to do is order a pizza, and then execute this script from the command line:... more
# 's
 1#!/usr/bin/env python
2
3# Copyright (c) 2008 Nick Jensen
4# MIT License
5
6import xml.dom.minidom
7import urllib, sys, datetime
8
9class Dominos:
10
11
12 def __init__(self, *args, **kw):
13 self.__feed_url = "http://trkweb.dominos.com/orderstorage/GetTrackerData"
14
15 def get_order_info(self, phone_number):
16 xml_data = urllib.urlopen('%s?Phone=%s' % (self.__feed_url, phone_number))
17 dom = xml.dom.minidom.parse(xml_data)
18 orders_node = dom.getElementsByTagName('OrderStatuses')
19 order = orders_node[0].getElementsByTagName('OrderStatus')
20
21 if order.length > 0:
22 description = order[0].getElementsByTagName('OrderDescription')[0].firstChild.data
23 starttime = self.get_time(order[0].getElementsByTagName('StartTime')[0].firstChild)
24 oventime = self.get_time(order[0].getElementsByTagName('OvenTime')[0].firstChild)
25 racktime = self.get_time(order[0].getElementsByTagName('RackTime')[0].firstChild)
26 routetime = self.get_time(order[0].getElementsByTagName('RouteTime')[0].firstChild)
27 deliverytime = self.get_time(order[0].getElementsByTagName('DeliveryTime')[0].firstChild)
28 return {'description':description, 'starttime':starttime, 'deliverytime':deliverytime,
29 'oventime':oventime, 'racktime':racktime, 'routetime':routetime}
30 else:
31 return False
32
33
34 def get_time(self, time_node):
35 if time_node:
36 [date, time] = time_node.data.split("T")
37 [hour, minute, second] = time.split(":")
38 ampm = 'pm'
39 if hour < 12:
40 ampm = 'am'
41 return '%s:%s%s' % (int(hour) % 12, minute, ampm)
42 else:
43 return None
44
45
46if __name__ == "__main__":
47
48 if len(sys.argv) != 2:
49 print 'usage: %s <phone number>' % sys.argv[0]
50 sys.exit(1)
51
52 print """Dominos (R) pizza tracker."""
53 d = Dominos()
54 order_info = d.get_order_info(sys.argv[1])
55
56 if not order_info:
57 print "No Orders Found for %s" % sys.argv[1]
58 else:
59 print order_info['description']
60 if order_info['starttime']: print "Your pizza is being made! %s" % order_info['starttime']
61 if order_info['oventime']: print "Your pizza is in the oven! %s" % order_info['oventime']
62 if order_info['racktime']: print "Your pizza is done and awaiting delivery! %s" % order_info['racktime']
63 if order_info['routetime']: print "Your pizza is on the way! %s" % order_info['routetime']
64 if order_info['deliverytime']: print "Your pizza was delivered! %s" % order_info['deliverytime']

All you have to do is order a pizza, and then execute this script from the command line:

python dominos.py 'your phone number'

You should get something like:

http://www.siafoo.net/image/176