diff --git a/scripts/common/rest_api_helpers.py b/scripts/common/rest_api_helpers.py index 4068a5e1e..31f973e81 100644 --- a/scripts/common/rest_api_helpers.py +++ b/scripts/common/rest_api_helpers.py @@ -48,7 +48,7 @@ def query_api(url: str, params: Mapping[str, str], debug_requests=False) -> dict if len(params) > 0: print(f'QUERY: {params}') - response = requests.get(url, params=params) + response = requests.get(url, params=params, timeout=60) response.raise_for_status() if debug_requests: @@ -67,7 +67,7 @@ def download_file(url: str, target_path: Path, overwrite=False): if not overwrite and target_path.exists(): raise FileAlreadyExists(f"Refusing to overwrite existing file: '{target_path}'.") - with requests.get(url, stream=True) as request: + with requests.get(url, stream=True, timeout=60) as request: with open(target_path, 'wb') as target_file: shutil.copyfileobj(request.raw, target_file) diff --git a/test/scripts/test_externalTests_benchmark_downloader.py b/test/scripts/test_externalTests_benchmark_downloader.py index e29d14011..aead61847 100644 --- a/test/scripts/test_externalTests_benchmark_downloader.py +++ b/test/scripts/test_externalTests_benchmark_downloader.py @@ -31,7 +31,7 @@ def _git_run_command_mock(command): "If you have updated the code, please remember to add matching command fixtures above." ) -def _requests_get_mock(url, params): +def _requests_get_mock(url, params, timeout): response_mock = Mock() if url == 'https://api.github.com/repos/ethereum/solidity/pulls/12818': @@ -174,6 +174,7 @@ def _requests_get_mock(url, params): "The test tried to perform an unexpected GET request.\n" f"URL: {url}\n" + (f"query: {params}\n" if len(params) > 0 else "") + + f"timeout: {timeout}\n" + "If you have updated the code, please remember to add matching response fixtures above." )