File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1159,8 +1159,20 @@ def populate_registry(self, pooch):
1159
1159
1160
1160
for filedata in self .api_response .json ()["data" ]["latestVersion" ]["files" ]:
1161
1161
for algorithm in ["md5" , "sha1" , "sha256" , "sha512" ]:
1162
+ # Look for the checksum directly in the file dictionary
1162
1163
if algorithm in filedata ["dataFile" ]:
1163
1164
pooch .registry [filedata ["dataFile" ]["filename" ]] = (
1164
1165
f"{ algorithm } :{ filedata ['dataFile' ][algorithm ]} "
1165
1166
)
1166
1167
break
1168
+ # Look for the checksum in the checksum sub-dictionary
1169
+ if algorithm in filedata ["dataFile" ].get ("checksum" , {}):
1170
+ pooch .registry [filedata ["dataFile" ]["filename" ]] = (
1171
+ f"{ algorithm } :{ filedata ['dataFile' ]['checksum' ][algorithm ]} "
1172
+ )
1173
+ break
1174
+
1175
+ raise ValueError (
1176
+ f"Checksum for file '{ filedata ["dataFile" ]["filename" ]} '"
1177
+ " not found in the DataVerse API response."
1178
+ )
You can’t perform that action at this time.
0 commit comments