@@ -24,17 +24,19 @@ def __init__(self):
24
24
"http://sandbox.zenodo.org/record/" ,
25
25
],
26
26
"api" : "https://sandbox.zenodo.org/api/records/" ,
27
- "filepath" : "files" ,
28
- "filename" : "filename" ,
29
- "download" : "links.download" ,
27
+ "files" : "links.files" ,
28
+ "filepath" : "entries" ,
29
+ "filename" : "key" ,
30
+ "download" : "links.content" ,
30
31
"type" : "metadata.upload_type" ,
31
32
},
32
33
{
33
34
"hostname" : ["https://zenodo.org/record/" , "http://zenodo.org/record/" ],
34
35
"api" : "https://zenodo.org/api/records/" ,
35
- "filepath" : "files" ,
36
- "filename" : "filename" ,
37
- "download" : "links.download" ,
36
+ "files" : "links.files" ,
37
+ "filepath" : "entries" ,
38
+ "filename" : "key" ,
39
+ "download" : "links.content" ,
38
40
"type" : "metadata.upload_type" ,
39
41
},
40
42
{
@@ -43,6 +45,7 @@ def __init__(self):
43
45
"http://data.caltech.edu/records/" ,
44
46
],
45
47
"api" : "https://data.caltech.edu/api/record/" ,
48
+ "files" : "" ,
46
49
"filepath" : "metadata.electronic_location_and_access" ,
47
50
"filename" : "electronic_name.0" ,
48
51
"download" : "uniform_resource_identifier" ,
@@ -69,9 +72,17 @@ def fetch(self, spec, output_dir, yield_output=False):
69
72
f'{ host ["api" ]} { record_id } ' ,
70
73
headers = {"accept" : "application/json" },
71
74
)
72
-
73
75
record = resp .json ()
74
76
77
+ if host ["files" ]:
78
+ yield f"Fetching Zenodo record { record_id } files.\n "
79
+ files_url = deep_get (record , host ["files" ])
80
+ resp = self .urlopen (
81
+ files_url ,
82
+ headers = {"accept" : "application/json" },
83
+ )
84
+ record = resp .json ()
85
+
75
86
files = deep_get (record , host ["filepath" ])
76
87
only_one_file = len (files ) == 1
77
88
for file_ref in files :
0 commit comments