diff --git a/datahugger/base.py b/datahugger/base.py index f08bfdb..66dc001 100644 --- a/datahugger/base.py +++ b/datahugger/base.py @@ -162,6 +162,7 @@ def download_file( if not self.print_only: logging.info(f"Downloading file {file_link}") res = requests.get(file_link, stream=True) + res.raise_for_status() output_fp = Path(output_folder, file_name) Path(output_fp).parent.mkdir(parents=True, exist_ok=True) @@ -199,6 +200,8 @@ def _parse_url(self, url): def _unpack_single_folder(self, zip_url, output_folder): r = requests.get(zip_url) + r.raise_for_status() + z = zipfile.ZipFile(io.BytesIO(r.content)) for zip_info in z.infolist(): @@ -287,6 +290,7 @@ def _get_files_recursive(self, url, folder_name=None, base_url=None): # get the data from URL res = requests.get(url) + res.raise_for_status() response = res.json() # find path to raw files