BB: Rename post_json(data) parameter to json

This commit is contained in:
Mike Salvatore 2022-07-22 12:34:28 -04:00
parent 2d338fc81f
commit 5c60656f56
2 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ class MonkeyIslandClient(object):
@avoid_race_condition @avoid_race_condition
def run_monkey_local(self): def run_monkey_local(self):
response = self.requests.post_json("api/local-monkey", data={"action": "run"}) response = self.requests.post_json("api/local-monkey", json={"action": "run"})
if MonkeyIslandClient.monkey_ran_successfully(response): if MonkeyIslandClient.monkey_ran_successfully(response):
LOGGER.info("Running the monkey.") LOGGER.info("Running the monkey.")
else: else:
@ -61,7 +61,7 @@ class MonkeyIslandClient(object):
@avoid_race_condition @avoid_race_condition
def kill_all_monkeys(self): def kill_all_monkeys(self):
response = self.requests.post_json( response = self.requests.post_json(
"api/monkey-control/stop-all-agents", data={"kill_time": time.time()} "api/monkey-control/stop-all-agents", json={"kill_time": time.time()}
) )
if response.ok: if response.ok:
LOGGER.info("Killing all monkeys after the test.") LOGGER.info("Killing all monkeys after the test.")

View File

@ -83,9 +83,9 @@ class MonkeyIslandRequests(object):
) )
@_Decorators.refresh_jwt_token @_Decorators.refresh_jwt_token
def post_json(self, url, data: Dict): def post_json(self, url, json: Dict):
return requests.post( # noqa: DUO123 return requests.post( # noqa: DUO123
self.addr + url, json=data, headers=self.get_jwt_header(), verify=False self.addr + url, json=json, headers=self.get_jwt_header(), verify=False
) )
@_Decorators.refresh_jwt_token @_Decorators.refresh_jwt_token