nipoppy.zenodo_api.ZenodoAPI

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

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:

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

get_record_metadata(record_id)

Get the metadata of a Zenodo record.

Parameters:

record_id (str)

search_records(query, keywords=None, size=10)

Search for records in Zenodo.

Parameters:
set_authorization(access_token)

Set the headers for the ZenodoAPI instance.

Parameters:

access_token (str)

set_logger(logger)

Set the logger for the ZenodoAPI instance.

Parameters:

logger (logging.Logger)

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]
password_file = None
sandbox = False