From 344b0d3da64c3b374d085d0c5597a035871243e2 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Tue, 1 Oct 2024 16:50:07 +0200 Subject: [PATCH] Check all available checksum algorithm in DataVerse registry population --- pooch/downloaders.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pooch/downloaders.py b/pooch/downloaders.py index 9500389b..ffa8b31e 100644 --- a/pooch/downloaders.py +++ b/pooch/downloaders.py @@ -1158,6 +1158,9 @@ def populate_registry(self, pooch): """ for filedata in self.api_response.json()["data"]["latestVersion"]["files"]: - pooch.registry[filedata["dataFile"]["filename"]] = ( - f"md5:{filedata['dataFile']['md5']}" - ) + for algorithm in ["md5", "sha1", "sha256", "sha512"]: + if algorithm in filedata["dataFile"]: + pooch.registry[filedata["dataFile"]["filename"]] = ( + f"{algorithm}:{filedata['dataFile'][algorithm]}" + ) + break