mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
[PR #11112/f5c2c8b9 backport][stable-12] replace redundant to_native()/to_text() occurrences, batch 7 (#11142)
replace redundant to_native()/to_text() occurrences, batch 7 (#11112)
* replace redundant to_native()/to_text() occurrences, batch 7
* add changelog frag
* made changes per review
(cherry picked from commit f5c2c8b9a2)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,6 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
||||
@@ -70,7 +69,7 @@ class GandiLiveDNSAPI:
|
||||
|
||||
if content:
|
||||
try:
|
||||
result = json.loads(to_text(content, errors="surrogate_or_strict"))
|
||||
result = json.loads(content)
|
||||
except getattr(json, "JSONDecodeError", ValueError) as e:
|
||||
error_msg += f"; Failed to parse API response with error {e}: {content}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user