From f4f9ca6317f49cc63e2733e47fe9fdbb2e12192d Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 19 Sep 2022 08:18:46 -0400 Subject: [PATCH] Agent: Update island API client docstrings --- .../island_api_client/http_island_api_client.py | 12 +----------- .../island_api_client/i_island_api_client.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 14 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 d38c640d4..d9f9b1d9e 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 @@ -11,20 +11,10 @@ logger = logging.getLogger(__name__) class HTTPIslandAPIClient(IIslandAPIClient): """ - A client for requests from the Agent to the Island API + A client for the Island's HTTP API """ def __init__(self, island_server: str): - """ - Verifies connection to the Island by raising an error if it can't connect - - :param island_server: Address to the Island - :raises IslandAPIConnectionError: If a connection cannot be made with the Island - :raises IslandAPITimeoutError: If a timeout occurs before being able to connect - with the Island - :raises IslandAPIError: If an unexpected error occurs with the Island API - """ - try: requests.get( # noqa: DUO123 f"https://{island_server}/api?action=is-up", diff --git a/monkey/infection_monkey/island_api_client/i_island_api_client.py b/monkey/infection_monkey/island_api_client/i_island_api_client.py index ef45a9fe9..580158be5 100644 --- a/monkey/infection_monkey/island_api_client/i_island_api_client.py +++ b/monkey/infection_monkey/island_api_client/i_island_api_client.py @@ -2,11 +2,18 @@ from abc import ABC, abstractmethod class IIslandAPIClient(ABC): + """ + A client for the Island's API + """ + @abstractmethod def __init__(self, island_server: str): """ - Construct and API client and connect it to the island + Construct and island API client and connect it to the island - :param island_server: String representing the island ip address and port - :raises IslandAPIError: If connection was unsuccessful + :param island_server: The socket address of the API + :raises IslandAPIConnectionError: If a connection cannot be made to the island + :raises IslandAPITimeoutError: If a timeout occurs while attempting to connect to the island + :raises IslandAPIError: If an unexpected error occurred while attempting to connect to the + island """