do not crash if there are php errors before json
This commit is contained in:
parent
65169a8a8d
commit
b10f21334b
1 changed files with 5 additions and 4 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue