Skip to content

Commit cf9761a

Browse files
authored
remove any put or post non strictly necessary
1 parent 1ddc6eb commit cf9761a

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

scripts/update_and_release_to_zenodo.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,27 @@ def create_new_version():
2323
new_id = new_deposition["id"]
2424
print(f"New Zenodo deposition created: {new_id}")
2525

26-
# Step 2: Update the metadata for the new version
26+
# Step 2: Add the publication_date only (Zenodo will handle other metadata)
2727
today_date = datetime.today().strftime('%Y-%m-%d')
2828

29-
# Retrieve current metadata to update
30-
response = requests.get(f"{ZENODO_API_BASE}/{new_id}", headers=HEADERS)
31-
if response.status_code != 200:
32-
print(f"Error retrieving deposition metadata: {response.text}")
33-
sys.exit(1)
34-
35-
deposition = response.json()
36-
metadata = deposition["metadata"]
29+
# Prepare the metadata update with just the publication_date
30+
metadata_update = {
31+
"metadata": {
32+
"publication_date": today_date
33+
}
34+
}
3735

38-
# Add publication_date for the draft version
39-
metadata["publication_date"] = today_date
36+
# Convert to JSON string for the PUT request
37+
data = json.dumps(metadata_update)
4038

41-
# Convert data to JSON string for PUT request
42-
data = json.dumps({"metadata": metadata})
43-
44-
# Update the metadata using PUT request
39+
# Update the metadata with the publication_date
4540
response = requests.put(f"{ZENODO_API_BASE}/{new_id}", headers=HEADERS, data=data)
4641

4742
if response.status_code != 200:
4843
print(f"Error updating metadata: {response.text}")
4944
sys.exit(1)
5045

5146
print(f"Metadata updated for deposition {new_id}.")
52-
5347
return new_id
5448

5549
def delete_existing_files(deposition_id):

0 commit comments

Comments
 (0)