Agent: Update island API client docstrings

This commit is contained in:
Mike Salvatore 2022-09-19 08:18:46 -04:00
parent 43d6ebcc15
commit f4f9ca6317
2 changed files with 11 additions and 14 deletions

View File

@ -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",

View File

@ -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
"""