nipoppy.zenodo_api.ZenodoAPI

class nipoppy.zenodo_api.ZenodoAPI(sandbox=False, password_file=None, logger=None, timeout=10.0)

Client to interact with Zenodo API.

Zenodo uses the InvenioRDM API, which is documented at: https://inveniordm.docs.cern.ch/reference/rest_api_index/

Parameters:
download_record_files(record_id, output_dir)

Download the files of a Zenodo record in the output_dir directory.

Parameters:
  • record_id (str) – Record ID in Zenodo.

  • output_dir (Path) – Output directory to save the files.

Raises:

ChecksumError – Checksum mismatch between the downloaded file and the expected checksum.

get_latest_version_id(record_id)

Get the ID of the latest version of a Zenodo record.

Parameters:

record_id (str) – Record ID to query.

Returns:

ID of the latest version of the record.

Return type:

str

get_record_metadata(record_id)

Get the metadata of a Zenodo record.

Parameters:

record_id (str)

search_records(query, sort='mostdownloaded', community_id=None, keywords=None, size=10)

Search for records in Zenodo.

Parameters:
  • query (str)

  • sort (str)

  • community_id (Optional[str])

  • keywords (Optional[list[str]])

  • size (int)

set_authorization(access_token)

Set the headers for the ZenodoAPI instance.

Parameters:

access_token (str)

upload_pipeline(input_dir, metadata, record_id=None)

Upload a pipeline to Zenodo.

Parameters:
Return type:

str

access_token = None
api_endpoint = 'https://zenodo.org/api'
headers: dict[str, str]
property logger: logging.Logger

Get the logger for the ZenodoAPI instance.

Return type:

logging.Logger

password_file = None
sandbox = False
timeout = 10.0