mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Merge remote-tracking branch 'origin/master' into remove_otp_field
This commit is contained in:
commit
36fdb3733f
@ -104,6 +104,13 @@ def fetch_json(remote_url,
|
|||||||
data = None
|
data = None
|
||||||
try:
|
try:
|
||||||
data = json.loads(r.content.decode('utf-8'))
|
data = json.loads(r.content.decode('utf-8'))
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
# If the decoding fails, switch to slower but probably working .json()
|
||||||
|
try:
|
||||||
|
logging.warning("UTF-8 content.decode failed, switching to slower .json method")
|
||||||
|
data = r.json()
|
||||||
|
except Exception as e:
|
||||||
|
raise e
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
'Error while loading JSON data from {0}'.format(remote_url)) from e
|
'Error while loading JSON data from {0}'.format(remote_url)) from e
|
||||||
|
Loading…
Reference in New Issue
Block a user