From 1980c9e773fc86558cd5ddfaf02613fbf7c38338 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Fri, 17 Nov 2017 16:00:29 -0500 Subject: [PATCH] Pass proper error value to to_text (#33030) --- lib/ansible/modules/net_tools/cloudflare_dns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/net_tools/cloudflare_dns.py b/lib/ansible/modules/net_tools/cloudflare_dns.py index a5c9475ec8d..e2ee91c854a 100644 --- a/lib/ansible/modules/net_tools/cloudflare_dns.py +++ b/lib/ansible/modules/net_tools/cloudflare_dns.py @@ -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)