annotate server/dump.py @ 447:8fdf86ea41e7

few updates, seems to run
author Matt Johnston <matt@ucc.asn.au>
date Sat, 15 Dec 2012 23:49:08 +0800
parents 649648020123
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
359
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 #!/usr/bin/env python2.7
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 BTADDR = "00:12:03:27:70:88"
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 SLEEP_TIME = 5
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 # time that the bluetooth takes to get going?
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 EXTRA_WAKEUP = 0
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 FETCH_TRIES = 3
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 # avoid turning off the bluetooth etc.
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 TESTING = False
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 import sys
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 # for wrt
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 sys.path.append('/root/python')
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 import httplib
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 import time
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 import traceback
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 import binascii
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 import hmac
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 import zlib
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 import urllib
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 import urllib2
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 import config
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 from utils import monotonic_time, retry, readline, crc16
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 lightblue = None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 try:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 import lightblue
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 except ImportError:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 import bluetooth
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 def get_socket(addr):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 if lightblue:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37 s = lightblue.socket()
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 s.connect((addr, 1))
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 s.settimeout(3)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 else:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41 s = bluetooth.BluetoothSocket( bluetooth.RFCOMM )
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 s.connect((addr, 1))
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 s.setblocking(False)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 return s
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49 @retry()
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 def fetch(sock):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 print "fetch"
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 sock.send("fetch\n")
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54 crc = 0
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56 lines = []
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 l = readline(sock)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 if l != 'START\n':
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59 print>>sys.stderr, "Bad expected START line '%s'\n" % l.rstrip('\n')
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 return None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 crc = crc16(l, crc)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63 while True:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 l = readline(sock)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66 crc = crc16(l, crc)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68 if l == 'END\n':
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
69 break
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
70
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71 lines.append(l.rstrip('\n'))
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73 print lines
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
74
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
75 l = readline(sock)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
76 recv_crc = None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
77 try:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
78 k, v = l.rstrip('\n').split('=')
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
79 print k,v
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
80 if k == 'CRC':
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
81 recv_crc = int(v)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
82 if recv_crc < 0 or recv_crc > 0xffff:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
83 recv_crc = None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
84 except ValueError:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
85 pass
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
86
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
87 if recv_crc is None:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
88 print>>sys.stderr, "Bad expected CRC line '%s'\n" % l.rstrip('\n')
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
89 return None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91 if recv_crc != crc:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
92 print>>sys.stderr, "Bad CRC: calculated 0x%x vs received 0x%x\n" % (crc, recv_crc)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
93 return None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
95 return lines
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97 @retry()
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98 def turn_off(sock):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
99 if TESTING:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
100 return 99
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101 print>>sys.stderr, "sending btoff"
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
102 sock.send("btoff\n");
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
103 # read newline
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
104 l = readline(sock)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
105 if not l:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
106 print>>sys.stderr, "Bad response to btoff\n"
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
107 return None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
108
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
109 if not l.startswith('off:'):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
110 print>>sys.stderr, "Bad response to btoff '%s'\n" % l
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
111 return None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
112 off, next_wake = l.rstrip().split(':')
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
113 print>>sys.stderr, "Next wake %s" % next_wake
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
114
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
115 return int(next_wake)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
116
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
117 @retry()
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
118 def clear_meas(sock):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
119 sock.send("clear\n");
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
120 l = readline(sock)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
121 if l and l.rstrip() == 'cleared':
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
122 return True
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
123
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
124 print>>sys.stderr, "Bad response to clear %s\n" % str(l)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
125 return False
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
126
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
127 def send_results(lines):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
128 enc_lines = binascii.b2a_base64(zlib.compress('\n'.join(lines)))
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
129 mac = hmac.new(config.HMAC_KEY, enc_lines).hexdigest()
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
130
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
131 url_data = urllib.urlencode( {'lines': enc_lines, 'hmac': mac} )
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
132 con = urllib2.urlopen(config.UPDATE_URL, url_data)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
133 result = con.read(100)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
134 if result == 'OK':
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
135 return True
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
136 else:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
137 print>>sys.stderr, "Bad result '%s'" % result
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
138 return False
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
139
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
140 def do_comms(sock):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
141 args = sys.argv[1:]
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
142 print "do_comms"
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
143 for a in args:
392
1a5f2449f760 fix dump.py's sock.send()
Matt Johnston <matt@ucc.asn.au>
parents: 359
diff changeset
144 sock.send('%s\n' % a)
359
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
145
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
146 while True:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
147 l = readline(sock)
429
649648020123 log errors too
Matt Johnston <matt@ucc.asn.au>
parents: 392
diff changeset
148 if not l:
649648020123 log errors too
Matt Johnston <matt@ucc.asn.au>
parents: 392
diff changeset
149 print '.',
649648020123 log errors too
Matt Johnston <matt@ucc.asn.au>
parents: 392
diff changeset
150 sys.stdout.flush()
649648020123 log errors too
Matt Johnston <matt@ucc.asn.au>
parents: 392
diff changeset
151 else:
649648020123 log errors too
Matt Johnston <matt@ucc.asn.au>
parents: 392
diff changeset
152 print l
359
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
153
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
154 testcount = 0
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
155
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
156 def sleep_for(secs):
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
157 until = monotonic_time() + secs
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
158 while True:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
159 length = until - monotonic_time()
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
160 if length <= 0:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
161 return
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
162 time.sleep(length)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
163
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
164 def main():
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
165 next_wake_time = 0
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
166
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
167 while True:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
168 sock = None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
169 try:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
170 sock = get_socket(BTADDR)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
171 except Exception, e:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
172 print>>sys.stderr, "Error connecting:"
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
173 traceback.print_exc(file=sys.stderr)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
174 sleep_time = SLEEP_TIME
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
175 if sock:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
176 next_wake = None
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
177 try:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
178 next_wake_interval = do_comms(sock)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
179 next_wake_time = time.time() + next_wake_interval
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
180 except Exception, e:
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
181 print>>sys.stderr, "Error in do_comms:"
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
182 traceback.print_exc(file=sys.stderr)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
183 if next_wake_time > time.time():
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
184 sleep_time = min(next_wake_time - time.time() - EXTRA_WAKEUP, sleep_time)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
185
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
186 print "Sleeping for %d" % sleep_time
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
187 sleep_for(sleep_time)
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
188
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
189 if __name__ == '__main__':
53b24a353e13 add dump program
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
190 main()