Zenodo API

Zenodo interactions handling

openscm_zenodo.zenodo.create_new_zenodo_version(deposition_id, zenodo_url, token, deposit_metadata)[source]

Create a new version of a Zenodo record (i.e. a specific deposition ID)

Parameters
  • deposition_id (str) – Deposition ID of any DOI which represents a specific version of the record, but crucially not the DOI which represents all versions of the record (this won’t work).

  • zenodo_url (str) – Zenodo url to upload the file to (e.g. sandbox.zenodo.org or zenodo.org)

  • token (str) – Token to use to authenticate the request

  • deposit_metadata (str) – Path to file containing metadata for this new version

Returns

The deposition ID of the new version of the record

Return type

str

openscm_zenodo.zenodo.get_bucket_id(deposition_id, zenodo_url, token)[source]

Get bucket ID for a given Zenodo deposition ID

Parameters
  • deposition_id (str) – Deposition ID to check

  • zenodo_url (str) – Zenodo url to upload the file to (e.g. sandbox.zenodo.org or zenodo.org)

  • token (str) – Token to use to authenticate the request

Returns

The bucket associated with deposition_id

Return type

str

openscm_zenodo.zenodo.upload_file(filepath, bucket, zenodo_url, token, root_dir=None)[source]

Upload file to Zenodo

Parameters
  • filepath (str) – Path to file to upload

  • bucket (str) – Bucket to upload the file to

  • zenodo_url (str) – Zenodo url to upload the file to (e.g. sandbox.zenodo.org or zenodo.org)

  • token (str) – Token to use to authenticate the upload

  • root_dir (str) – Path to remove from filename before uploading. If not supplied, only the filename is used for uploading i.e. all preceeding directories are stripped.