From 4746974b3a218210e1f4ac56f9aa2b592f1c12c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Zar=C4=99bski?= Date: Thu, 16 Jul 2026 12:22:44 +0100 Subject: [PATCH] Remove inspecting JSON output when downloading file data --- simvue/api/objects/artifact/base.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/simvue/api/objects/artifact/base.py b/simvue/api/objects/artifact/base.py index 813fc096..78d8ffaa 100644 --- a/simvue/api/objects/artifact/base.py +++ b/simvue/api/objects/artifact/base.py @@ -409,7 +409,9 @@ def download_content(self) -> Generator[bytes]: f"Could not retrieve URL for artifact '{self._identifier}'", ) - _timeout = BASE_TIMEOUT + DOWNLOAD_TIMEOUT_PER_MB * self.size / 1024 / 1024 + _timeout: int = int( + BASE_TIMEOUT + DOWNLOAD_TIMEOUT_PER_MB * self.size / 1024 // 1024 + ) self._logger.debug( "Will wait %s for download of file %s of size %s", @@ -425,12 +427,12 @@ def download_content(self) -> Generator[bytes]: headers=None, ) - get_json_from_response( - response=_response, - allow_parse_failure=True, - expected_status=[http.HTTPStatus.OK], - scenario=f"Retrieval of file for {self.label()} '{self._identifier}'", - ) + if _response.status_code != http.HTTPStatus.OK: + raise RuntimeError( + f"Retrieval of file date for {self.label()} '{self._identifier}' " + + f"failed for url '{self.download_url}' " + + f"with status code {_response.status_code}" + ) _total_length: str | None = _response.headers.get("content-length")