Client to work with Zenodo API
Project description
ZennewPy
ZennewPy is a Python package for interacting with the Zenodo API, allowing users to manage depositions, metadata, and files on Zenodo.
Features
- Retrieve all depositions with full metadata
- Find community identifiers
- Set and unset depositions
- Create, delete, and manage depositions
- Upload and update files
- Publish depositions
- Create new versions of existing depositions
- Modify metadata for both published and unpublished depositions
Installation
pip install zennewpy
Usage
- Create a Zenodo access token by first logging into your account and clicking on your username in the top right corner. Navigate to "Applications" and then "+new token" under "Personal access tokens". Keep this window open while you proceed to step 2 because the token is only displayed once. Note that Sandbox.zenodo is used for testing and zenodo for production. If you want to use both, create for each a token as desribed above.
- Store the token in
~/.zenodo_tokenusing the following command.
# zenodo token
{ echo 'ACCESS_TOKEN: your_access_token_here' } > ~/.zenodo_token
# sandbox.zenodo token
{ echo 'ACCESS_TOKEN-sandbox: your_access_token_here' } > ~/.zenodo_token
import zennewpy
# Initialize the client
client = zennewpy.Client(sandbox=True)
# Set up your Zenodo token
# Ensure you have a ~/.zenodo_token file with your ACCESS_TOKEN
# Create a new deposition
deposition_id = client.create_new_deposition()
# Set the client to work with this deposition
client.set_deposition(deposition_id)
# Add metadata
metadata = {
"title": "My Research Data",
"description": "This dataset contains...",
"upload_type": "dataset"
}
client.create_metadata(metadata)
# Upload a file
client.upload_file("path/to/your/file.csv")
# Publish the deposition
client.publish_deposition()
Main Classes and Methods
Client
The main class for interacting with Zenodo.
__init__(self, title=None, bucket=None, deposition_id=None, sandbox=None, token=None)get_all_depositions()set_deposition(id_value)create_new_deposition()delete_deposition(deposition_id=None)create_metadata(metadata, **kwargs)upload_file(file_path, remote_filename=None, file_id=None)publish_deposition()create_new_version()modify_metadata(metadata_updates, **kwargs)
Authentication
ZennewPy uses a token-based authentication system. Store your Zenodo API token in a ~/.zenodo_token file.
Contributing
Contributions to ZennewPy are welcome. Please ensure you follow the coding style and add unit tests for any new features.
Acknowledgments
ZennewPy is a fork of zenodopy, an original project by L. Gloege. This package builds upon the foundational work of the original zenodopy library, extending and modifying its functionality while maintaining the core API interaction principles.
License
ZennewPy is distributed under the MIT License, which allows for free use, modification, and distribution of the software, in line with the original zenodopy project's licensing. Key Acknowledgment: This project respectfully derives from and credits the original zenodopy library, preserving its open-source spirit and collaborative approach.
Citation
If you use ZennewPy in your research, please cite it using the information provided in our CITATION.cff file. You can find this file in the root directory of our GitHub repository.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zennewpy-0.1.2.tar.gz.
File metadata
- Download URL: zennewpy-0.1.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5555789e2a4a1dc04ad257d8884ad8a3af046215ce73105a2f926fd361b2dd50
|
|
| MD5 |
9fee241273662edda67d9525075bbf4d
|
|
| BLAKE2b-256 |
6cc0798f4e4ded6576b16313fb17da855577a4499c12b1bb72795f6840362b74
|
File details
Details for the file zennewpy-0.1.2-py3-none-any.whl.
File metadata
- Download URL: zennewpy-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0be23561455854b5d2d68ee6dd2e06c1b13d311f9f09e2bcb93b5a4c3f339615
|
|
| MD5 |
513bb90b0e6a7dff378e25da110c005b
|
|
| BLAKE2b-256 |
ee6ac5daef37eda3b1d7bf7d5642bada39e75a84d5d8e9b8284f9e1e4d53381d
|