Skip to content

Commit

Permalink
toggle publish off
Browse files Browse the repository at this point in the history
  • Loading branch information
elichad committed May 14, 2024
1 parent bd203e5 commit 59006ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
zenodo-client>=0.3.3
zenodo-client>=0.3.4
rocrate
15 changes: 8 additions & 7 deletions ro_crate_uploader/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pydantic_core import ValidationError
from rocrate.rocrate import ROCrate
from zenodo_client import Metadata, ensure_zenodo
from zenodo_client import Metadata, create_zenodo

from ro_crate_uploader.authors import build_zenodo_creator_list

Expand Down Expand Up @@ -55,17 +55,18 @@ def ensure_crate_zipped(crate: ROCrate) -> str:
def upload_crate_to_zenodo(crate_zip_path: str, metadata: Metadata):
"""Upload a zipped crate and its metadata to Zenodo.
This will publish a record when run, so it's recommended to keep
sandbox=True until a publish toggle is added to zenodo-client."""
res = ensure_zenodo(
It's recommended to keep sandbox=True until ready for production use."""
# for now, create only, don't update
res = create_zenodo(
# this is a unique key you pick that will be used to store
# the numeric deposition ID on your local system's cache
key="ro-crate-uploader",
# key="ro-crate-uploader",
data=metadata,
paths=[
crate_zip_path,
],
sandbox=True, # remove this when you're ready to upload to real Zenodo
publish=False,
)

return res.json()
Expand All @@ -79,5 +80,5 @@ def upload_crate_to_zenodo(crate_zip_path: str, metadata: Metadata):
metadata = build_zenodo_metadata_from_crate(crate)
crate_zip_path = ensure_crate_zipped(crate)
print(crate_zip_path, metadata)
# record = upload_crate_to_zenodo(crate_zip_path, metadata)
# print(record)
record = upload_crate_to_zenodo(crate_zip_path, metadata)
print(record)

0 comments on commit 59006ba

Please sign in to comment.