From 2a1396c82da7615f2145ef64f1b6b28874eec525 Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Tue, 20 Sep 2022 18:33:05 +0000 Subject: [PATCH] Agent: Use response.json() in HTTPIslandAPIClient --- .../island_api_client/http_island_api_client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/island_api_client/http_island_api_client.py b/monkey/infection_monkey/island_api_client/http_island_api_client.py index 819b774d0..467f97252 100644 --- a/monkey/infection_monkey/island_api_client/http_island_api_client.py +++ b/monkey/infection_monkey/island_api_client/http_island_api_client.py @@ -159,8 +159,7 @@ class HTTPIslandAPIClient(IIslandAPIClient): ) response.raise_for_status() - json_response = json.loads(response.content.decode()) - return json_response["stop_agent"] + return response.json()["stop_agent"] @handle_island_errors @convert_json_error_to_island_api_error @@ -172,7 +171,7 @@ class HTTPIslandAPIClient(IIslandAPIClient): ) response.raise_for_status() - config_dict = json.loads(response.text) + config_dict = response.json() logger.debug(f"Received configuration:\n{pformat(config_dict)}")