forked from p15670423/monkey
Agent: Update island API client docstrings
This commit is contained in:
parent
43d6ebcc15
commit
f4f9ca6317
|
@ -11,20 +11,10 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class HTTPIslandAPIClient(IIslandAPIClient):
|
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):
|
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:
|
try:
|
||||||
requests.get( # noqa: DUO123
|
requests.get( # noqa: DUO123
|
||||||
f"https://{island_server}/api?action=is-up",
|
f"https://{island_server}/api?action=is-up",
|
||||||
|
|
|
@ -2,11 +2,18 @@ from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
|
||||||
class IIslandAPIClient(ABC):
|
class IIslandAPIClient(ABC):
|
||||||
|
"""
|
||||||
|
A client for the Island's API
|
||||||
|
"""
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self, island_server: str):
|
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
|
:param island_server: The socket address of the API
|
||||||
:raises IslandAPIError: If connection was unsuccessful
|
: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
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue