From 7e8101aa986923287b469758b765f56f7ae2ceba Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Tue, 6 May 2014 04:47:44 +0200 Subject: doorwatch: handle empty responses --- doorwatch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doorwatch.py b/doorwatch.py index b45a1c2..cdb22fb 100644 --- a/doorwatch.py +++ b/doorwatch.py @@ -24,7 +24,10 @@ if __name__ == '__main__': if last_ref is not None: req_url += '?' + last_ref r = urllib2.urlopen(req_url, timeout=120) - data = json.loads(r.read()) + buf = r.read() + if not buf.strip(): + continue + data = json.loads(buf) except Exception: sys.excepthook(*sys.exc_info()) last_ref = None -- cgit v1.2.1