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:
sandbox (bool)
password_file (Optional[pathlib.Path])
logger (Optional[logging.Logger])
- 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.
- search_records(query, keywords=None, size=10)¶
Search for records in Zenodo.
- 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:
input_dir (pathlib.Path)
metadata (dict)
record_id (Optional[str])
- Return type:
- access_token = None¶
- api_endpoint = 'https://zenodo.org/api'¶
- password_file = None¶
- sandbox = False¶