annotate old/server/dump.py @ 623:03167105f6de rust

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