File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ def caltechdata_edit(
6666 default_preview = None ,
6767 authors = False ,
6868 keepfiles = False ,
69+ return_id = False ,
6970):
7071 # Make a copy of the metadata to make sure our local changes don't leak
7172 metadata = copy .deepcopy (metadata )
@@ -299,10 +300,13 @@ def caltechdata_edit(
299300 result = requests .post (publish_link , headers = headers )
300301 if result .status_code != 202 :
301302 raise Exception (result .text )
302- pids = result .json ()["pids" ]
303- if "doi" in pids :
304- return pids ["doi" ]["identifier" ]
303+ if return_id :
304+ return result .json ()["id" ]
305305 else :
306- return pids ["oai" ]["identifier" ]
306+ pids = result .json ()["pids" ]
307+ if "doi" in pids :
308+ return pids ["doi" ]["identifier" ]
309+ else :
310+ return pids ["oai" ]["identifier" ]
307311 else :
308312 return idv
You can’t perform that action at this time.
0 commit comments