Commit cac1e215 authored by Enrique Garcia's avatar Enrique Garcia
Browse files

take out metadata root key and update the update_metadata method in agreement with this

parent 905e96bc
Pipeline #111330 failed with stages
in 34 seconds
......@@ -109,7 +109,7 @@ class ZenodoAPI:
return upload.json()
def update_metadata_entry(self, entry_id, data):
def update_metadata_entry(self, entry_id, json_metadata):
"""
Update an entry resource. Data should be the entry information that will be shown when a deposition is visited
at the Zenodo site.
......@@ -118,7 +118,7 @@ class ZenodoAPI:
:param entry_id: str
deposition_id of the Zenodo entry
:param data: object
:param json_metadata: object
json object containing the metadata (compulsory fields) that are enclosed when a new entry is created.
:return: obj
......@@ -128,6 +128,8 @@ class ZenodoAPI:
headers = {"Content-Type": "application/json"}
parameters = {'access_token': self.access_token}
data = {"metadata": json_metadata}
return requests.put(url, data=json.dumps(data),
headers=headers, params=parameters)
......@@ -301,7 +303,8 @@ class ZenodoAPI:
with open(self.path_zenodo_metadata_file) as file:
metadata_entry = json.load(file)
update_metadata = self.update_metadata_entry(test_entry_id,
data=metadata_entry)
json_metadata=metadata_entry)
if update_metadata.status_code == 200:
print(" * Update metadata status OK !")
pprint.pprint(metadata_entry)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment