diff --git a/src/input4mips_validation/cvs/loading_raw.py b/src/input4mips_validation/cvs/loading_raw.py index a492a875..d44efc14 100644 --- a/src/input4mips_validation/cvs/loading_raw.py +++ b/src/input4mips_validation/cvs/loading_raw.py @@ -113,7 +113,9 @@ class RawCVLoaderKnownRemoteRegistry: Whether to force a new download of the file if it already exists """ - def load_raw(self, filename: str) -> str: + def load_raw( + self, filename: str, downloader: pooch.HTTPDownloader | None = None + ) -> str: """ Load raw CV data @@ -122,6 +124,11 @@ def load_raw(self, filename: str) -> str: filename Filename from which to load raw CV data + downloader + Downloader to use when fetching. + + If not supplied, we use a basic default HTTP downloader. + Returns ------- Raw CV data @@ -131,7 +138,13 @@ def load_raw(self, filename: str) -> str: if expected_out_file.exists(): expected_out_file.unlink() - with open(Path(self.registry.fetch(filename))) as fh: + if downloader is None: + downloader = pooch.HTTPDownloader( + # https://github.com/readthedocs/readthedocs.org/issues/11763 + headers={"User-Agent": "input4mips-validation"} + ) + + with open(Path(self.registry.fetch(filename, downloader=downloader))) as fh: raw = fh.read() return raw