Skip to content

Commit

Permalink
Fix lookup of file URL
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Mar 18, 2021
1 parent b55d2eb commit 1a10cbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/zenodo_client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,13 @@ def download(self, record_id: Union[int, str], path: str, *, force: bool = False
concept_record_id = res_json['conceptrecid']
version = res_json['metadata']['version']
logger.debug('version for zenodo.record:%s is %s', record_id, version)
url = f'{self.base}/record/{record_id}/files/{path}'

for file in res_json['files']:
if file['key'] == path:
url = file['links']['self']
break
else:
raise FileNotFoundError(f'zenodo.record:{record_id} does not have a file with key {path}')

if parts is None:
parts = ['zenodo', concept_record_id, version, path]
Expand Down

0 comments on commit 1a10cbc

Please sign in to comment.