summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2014-05-06 04:47:44 +0200
committerChristian Franke <nobody@nowhere.ws>2014-05-06 04:47:44 +0200
commit7e8101aa986923287b469758b765f56f7ae2ceba (patch)
tree43f412ef8c1c967c296de8ad5cc6631a187e91c3
parenteb4fd3504f63e665166d6a76eeaa79f687430877 (diff)
doorwatch: handle empty responses
-rw-r--r--doorwatch.py5
1 files changed, 4 insertions, 1 deletions
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