From 1d6d71e9aca5356f67f933230cc00d092768696c Mon Sep 17 00:00:00 2001 From: James Bunton Date: Fri, 8 Jun 2012 17:06:18 +1000 Subject: [PATCH] SBS is dumb, they send XML as an error response --- sbs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sbs.py b/sbs.py index 6e85346..1d31848 100644 --- a/sbs.py +++ b/sbs.py @@ -82,7 +82,11 @@ def fill_entry(get_catnode, entry): def fill_section(get_catnode, section): index = 1 while True: - doc = grab_json(BASE + MENU_URL % (section, index), 3600) + try: + doc = grab_json(BASE + MENU_URL % (section, index), 3600) + except ValueError: + # SBS sends XML as an error message :\ + break if len(doc.get("entries", [])) == 0: break for entry in doc["entries"]: -- 2.39.2