Pass proper error value to to_text (#33030)

This commit is contained in:
Sam Doran 2017-11-17 16:00:29 -05:00 committed by GitHub
parent 2ef438c962
commit 1980c9e773
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -370,7 +370,7 @@ class CloudflareAPI(object):
if content:
try:
result = json.loads(to_text(content, errors='surrogate_then_strict'))
result = json.loads(to_text(content, errors='surrogate_or_strict'))
except (json.JSONDecodeError, UnicodeError) as e:
error_msg += "; Failed to parse API response with error {0}: {1}".format(to_native(e), content)