Earlier today, we got a 404 error from the Figshare API when performing a data curation. As it turns out the user deleted their dataset, which also meant that the metadata does not exit. To rectify this issue, we should have some try/except to handle non-metadata record.
Here are the results in the log:
11:06:29 - INFO: ** SAVING CURATION METADATA **
11:06:29 - INFO: Writing: /Users/cly/Documents/Curation/1.ToDo/*****/v01/METADATA/curation_original_*****.json
11:06:29 - WARNING: Caught an HTTPError: 404 Client Error: Not Found for url: https://api.figshare.com/v2/account/articles/*****
--- Logging error ---
Traceback (most recent call last):
File "/Users/cly/codes/UALibraries/redata-commons/redata/commons/issue_request.py", line 49, in redata_request
response.raise_for_status()
File "/Applications/anaconda3/envs/figshare/lib/python3.7/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.figshare.com/v2/account/articles/*****
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/anaconda3/envs/figshare/lib/python3.7/logging/__init__.py", line 1025, in emit
msg = self.format(record)
File "/Applications/anaconda3/envs/figshare/lib/python3.7/logging/__init__.py", line 869, in format
return fmt.format(record)
File "/Applications/anaconda3/envs/figshare/lib/python3.7/logging/__init__.py", line 608, in format
record.message = record.getMessage()
File "/Applications/anaconda3/envs/figshare/lib/python3.7/logging/__init__.py", line 369, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File "/Users/cly/codes/UALibraries/LD_Cool_P/ldcoolp/scripts/prereq_script", line 99, in <module>
metadata_only=args.metadata_only)
File "/Users/cly/codes/UALibraries/LD_Cool_P/ldcoolp/curation/main.py", line 162, in workflow
pw.reserve_doi()
File "/Users/cly/codes/UALibraries/LD_Cool_P/ldcoolp/curation/main.py", line 88, in reserve_doi
doi_string = self.fs_admin.reserve_doi(self.article_id)
File "/Users/cly/codes/UALibraries/ldcoolp-figshare/ldcoolp_figshare/main.py", line 504, in reserve_doi
doi_check, doi_string = self.doi_check(article_id)
File "/Users/cly/codes/UALibraries/ldcoolp-figshare/ldcoolp_figshare/main.py", line 478, in doi_check
process=process)
File "/Users/cly/codes/UALibraries/redata-commons/redata/commons/issue_request.py", line 56, in redata_request
log.warning('Body:\n', response.text)
Message: 'Body:\n'
Arguments: ('{"message": "Entity not found: Article", "code": "EntityNotFound"}',)
Traceback (most recent call last):
File "/Users/cly/codes/UALibraries/LD_Cool_P/ldcoolp/scripts/prereq_script", line 99, in <module>
metadata_only=args.metadata_only)
File "/Users/cly/codes/UALibraries/LD_Cool_P/ldcoolp/curation/main.py", line 162, in workflow
pw.reserve_doi()
File "/Users/cly/codes/UALibraries/LD_Cool_P/ldcoolp/curation/main.py", line 88, in reserve_doi
doi_string = self.fs_admin.reserve_doi(self.article_id)
File "/Users/cly/codes/UALibraries/ldcoolp-figshare/ldcoolp_figshare/main.py", line 504, in reserve_doi
doi_check, doi_string = self.doi_check(article_id)
File "/Users/cly/codes/UALibraries/ldcoolp-figshare/ldcoolp_figshare/main.py", line 478, in doi_check
process=process)
File "/Users/cly/codes/UALibraries/redata-commons/redata/commons/issue_request.py", line 49, in redata_request
response.raise_for_status()
File "/Applications/anaconda3/envs/figshare/lib/python3.7/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.figshare.com/v2/account/articles/*****
Objectives
Graceful exit and warning that deposit does not exist.
Summary
Earlier today, we got a 404 error from the Figshare API when performing a data curation. As it turns out the user deleted their dataset, which also meant that the metadata does not exit. To rectify this issue, we should have some try/except to handle non-metadata record.
Here are the results in the log:
Objectives
Graceful exit and warning that deposit does not exist.
Proposal
Testing notes
Additional notes
Implemented in: TBD