From 6001c0dacc89159234ab5c51def66afea4d4e405 Mon Sep 17 00:00:00 2001 From: Jared Ledvina Date: Sun, 29 Mar 2020 18:51:45 -0400 Subject: [PATCH] Always decode as UTF-8 Signed-off-by: Jared Ledvina --- module_utils/sensu_go.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module_utils/sensu_go.py b/module_utils/sensu_go.py index 735987b..5842720 100755 --- a/module_utils/sensu_go.py +++ b/module_utils/sensu_go.py @@ -103,7 +103,7 @@ def request(self, url, method="GET", data=None): if resp and info['status'] not in [201, 204]: response = resp.read() try: - return json.loads(response), info + return json.loads(response.readall().decode('utf-8')), info except Exception as e: self.fail_json( msg='Failed to parse response as JSON: {0}'.format(info),