Skip to content

Commit e17d8f9

Browse files
committed
Fix 'class DataverseFile' to handle old and new response format
Tests were failing after swith to new server/version
1 parent 2fe91a2 commit e17d8f9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dataverse/file.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def __init__(self, dataset, name, file_id=None):
1919

2020
@classmethod
2121
def from_json(cls, dataset, json):
22-
name = json['datafile']['name']
23-
file_id = json['datafile']['id']
22+
try:
23+
name = json['dataFile']['filename']
24+
file_id = json['dataFile']['id']
25+
except KeyError:
26+
name = json['datafile']['name']
27+
file_id = json['datafile']['id']
2428
return cls(dataset, name, file_id)

0 commit comments

Comments
 (0)