From 6f353331e61d3de4a236f17b6fdabb4f952bc74d Mon Sep 17 00:00:00 2001 From: James Frost Date: Tue, 17 Sep 2024 00:08:45 +0100 Subject: [PATCH] Fix HTTPFileRetriever The output_dir was in the wrong place, so it was making a POST request. --- src/CSET/_workflow_utils/fetch_data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CSET/_workflow_utils/fetch_data.py b/src/CSET/_workflow_utils/fetch_data.py index ce4ecb71e..22544c43a 100755 --- a/src/CSET/_workflow_utils/fetch_data.py +++ b/src/CSET/_workflow_utils/fetch_data.py @@ -104,8 +104,11 @@ def get_file(self, file_path: str, output_dir: str) -> None: Path to filesystem directory into which the file should be copied. """ ctx = ssl.create_default_context() - save_path = urllib.parse.urlparse(file_path).path.split("/")[-1] - with urllib.request.urlopen(file_path, output_dir, context=ctx) as response: + save_path = ( + f"{output_dir.removesuffix("/")}/" + + urllib.parse.urlparse(file_path).path.split("/")[-1] + ) + with urllib.request.urlopen(file_path, context=ctx) as response: with open(save_path, "wb") as fp: # Read in 1 MiB chunks so data doesn't all have to be in memory. while data := response.read(1024 * 1024):