Commit d7eea901 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Allow broken response from exchange API

parent 074cdbed
...@@ -61,7 +61,7 @@ def generate_requests(): ...@@ -61,7 +61,7 @@ def generate_requests():
def requeue_after_error(req, e): def requeue_after_error(req, e):
print >>sys.stderr, 'Error for %s:' % req.url, e.message print >>sys.stderr, 'Error:', e.message
status[req.url][1][0] += 0.5 status[req.url][1][0] += 0.5
queue.put((status[req.url][1][0], req.url)) queue.put((status[req.url][1][0], req.url))
...@@ -129,7 +129,12 @@ if __name__ == '__main__': ...@@ -129,7 +129,12 @@ if __name__ == '__main__':
stat[0] = scheduled = time.time() + interval stat[0] = scheduled = time.time() + interval
queue.put((scheduled, res.request.url)) queue.put((scheduled, res.request.url))
try:
last = res.json() last = res.json()
except ValueError as e:
print >>sys.stderr, 'invalid response from %s:' % exid, e.message
continue
for i in indices: for i in indices:
last = last[i] last = last[i]
last = float(last) last = float(last)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment