ZenodoClient
ZenodoClient(token: str, sandbox: bool = False, timeout: int = 30)Class for interacting with the Zenodo API.
Methods
| Name | Description |
|---|---|
| create | Creates a new deposit in editable state. |
| discard | Puts the deposit in a non-editable state by discarding all changes. |
| get_deposit | Gets the deposit with the given ID. |
| get_deposits | Gets all deposits. |
| make_editable | Makes the deposit editable. |
| new_version | Creates a new, unpublished version of a published deposit. |
| publish | Publishes a deposit. |
| update_metadata | Updates the metadata of a deposit. |
| upload_file | Uploads a file to a deposit. The deposit must be unpublished. |
create
ZenodoClient.create(metadata: ZenodoMetadata)Creates a new deposit in editable state.
Parameters
metadata : ZenodoMetadata-
The metadata of the new deposit.
Returns
ZenodoResponse-
The newly created deposit.
discard
ZenodoClient.discard(deposit: ZenodoResponse)Puts the deposit in a non-editable state by discarding all changes.
If the deposit’s state is unsubmitted, the deposit is deleted. If the deposit’s state is inprogress, the deposit is restored to the state when it was last published.
Parameters
deposit : ZenodoResponse-
The deposit.
get_deposit
ZenodoClient.get_deposit(deposit_id: Union[int, str])Gets the deposit with the given ID.
Parameters
deposit_id : Union[int, str]-
The ID of the deposit.
Returns
ZenodoResponse-
The deposit.
Raises
requests.exceptions.HTTPError-
If there is no deposit with the given ID.
get_deposits
ZenodoClient.get_deposits()Gets all deposits.
Returns
list[ZenodoResponse]-
The list of all deposits.
make_editable
ZenodoClient.make_editable(deposit: ZenodoResponse)Makes the deposit editable.
Parameters
deposit : ZenodoResponse-
The deposit.
Returns
ZenodoResponse-
The deposit in editable state.
new_version
ZenodoClient.new_version(deposit: ZenodoResponse)Creates a new, unpublished version of a published deposit.
Parameters
deposit : ZenodoResponse-
The deposit.
Returns
ZenodoResponse-
The new version of the deposit.
publish
ZenodoClient.publish(deposit: ZenodoResponse)Publishes a deposit.
Parameters
deposit : ZenodoResponse-
The deposit.
Returns
ZenodoResponse-
The published deposit.
update_metadata
ZenodoClient.update_metadata(deposit: ZenodoResponse, metadata: ZenodoMetadata)Updates the metadata of a deposit.
Parameters
deposit : ZenodoResponse-
The deposit.
metadata : ZenodoMetadata-
The new metadata.
Returns
ZenodoResponse-
The updated deposit.
upload_file
ZenodoClient.upload_file(deposit: ZenodoResponse, file_path: Path)Uploads a file to a deposit. The deposit must be unpublished.
Parameters
deposit : ZenodoResponse-
The deposit.
file_path : Path-
The path to the file.
Returns
ZenodoResponse-
Information about the uploaded file.