From b10f21334b9f96041d3135a2490660730ab32008 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 21 Jan 2012 17:54:17 +0100 Subject: [PATCH] do not crash if there are php errors before json --- modules/aum/browser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/aum/browser.py b/modules/aum/browser.py index 321126c7..e9d7906e 100644 --- a/modules/aum/browser.py +++ b/modules/aum/browser.py @@ -105,13 +105,14 @@ class AuMBrowser(BaseBrowser): A=action, P=parameter, O='json') - buf = self.openurl(url, data) + buf = self.openurl(url, data).read() try: - r = json.load(buf) + r = json.loads(buf[buf.find('{'):]) except ValueError: - buf.seek(0) - raise ValueError(buf.read()) + raise ValueError(buf) + + #pprint(r) if 'errors' in r and r['errors'] != '0' and len(r['errors']) > 0: code = r['errors'][0]