forked from p15670423/monkey
Agent: Call raise_for_status() in HTTPIslandAPIClient
This commit is contained in:
parent
a724758caa
commit
107a15b5f0
|
@ -46,23 +46,25 @@ class HTTPIslandAPIClient(IIslandAPIClient):
|
||||||
|
|
||||||
@handle_island_errors
|
@handle_island_errors
|
||||||
def __init__(self, island_server: str):
|
def __init__(self, island_server: str):
|
||||||
requests.get( # noqa: DUO123
|
response = requests.get( # noqa: DUO123
|
||||||
f"https://{island_server}/api?action=is-up",
|
f"https://{island_server}/api?action=is-up",
|
||||||
verify=False,
|
verify=False,
|
||||||
timeout=MEDIUM_REQUEST_TIMEOUT,
|
timeout=MEDIUM_REQUEST_TIMEOUT,
|
||||||
)
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
self._island_server = island_server
|
self._island_server = island_server
|
||||||
self._api_url = f"https://{self._island_server}/api"
|
self._api_url = f"https://{self._island_server}/api"
|
||||||
|
|
||||||
@handle_island_errors
|
@handle_island_errors
|
||||||
def send_log(self, log_contents: str):
|
def send_log(self, log_contents: str):
|
||||||
requests.post( # noqa: DUO123
|
response = requests.post( # noqa: DUO123
|
||||||
f"{self._api_url}/log",
|
f"{self._api_url}/log",
|
||||||
json=log_contents,
|
json=log_contents,
|
||||||
verify=False,
|
verify=False,
|
||||||
timeout=MEDIUM_REQUEST_TIMEOUT,
|
timeout=MEDIUM_REQUEST_TIMEOUT,
|
||||||
)
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
@handle_island_errors
|
@handle_island_errors
|
||||||
def get_pba_file(self, filename: str):
|
def get_pba_file(self, filename: str):
|
||||||
|
@ -71,5 +73,6 @@ class HTTPIslandAPIClient(IIslandAPIClient):
|
||||||
verify=False,
|
verify=False,
|
||||||
timeout=LONG_REQUEST_TIMEOUT,
|
timeout=LONG_REQUEST_TIMEOUT,
|
||||||
)
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
return response.content
|
return response.content
|
||||||
|
|
Loading…
Reference in New Issue