SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 4da4b753 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Tweak caller check methods

parent b19d0c87
No related branches found
No related tags found
No related merge requests found
......@@ -228,8 +228,10 @@ class FigshareCaller:
}
def _result_present(self, data):
if 'id' in data and data['id'] == int(self.identifier):
return True
try:
return data['id'] == int(self.identifier)
except KeyError:
pass
return False
......@@ -272,7 +274,6 @@ class OSFPreprintsCaller:
def _format_data(self):
"""Format data to prefill SubmissionForm as much as possible"""
print(self._osfpreprints_data)
title = self._osfpreprints_data['attributes']['title']
contributors_data = self._osfpreprints_data['embeds']['contributors']['data']
author_list = [d['embeds']['users']['data']['attributes']['full_name'] for d in contributors_data]
......@@ -293,8 +294,8 @@ class OSFPreprintsCaller:
}
def _result_present(self, response_content):
if ('data' in response_content and
'id' in response_content['data'] and
response_content['data']['id'] == self.identifier):
return True
try:
return response_content['data']['id'] == self.identifier
except KeyError:
pass
return False
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment