Skip to content

Commit

Permalink
Get api key before checking args
Browse files Browse the repository at this point in the history
  • Loading branch information
dianakolusheva committed Feb 25, 2021
1 parent 7eefee7 commit d74d816
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions emmaa_service/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1640,15 +1640,16 @@ def submit_curation_endpoint(hash_val, **kwargs):
res_dict = {"result": "failure",
"reason": "POST with API key requires a user email."}
return jsonify(res_dict), 400
logger.info("Adding curation for statement %s." % hash_val)
ev_hash = request.json.get('ev_hash')
tag = request.json.get('tag')
text = request.json.get('text')
api_key = roles[0].api_key
if not api_key:
res_dict = {"result": "failure",
"reason": "API key is required to submit curations."}
return jsonify(res_dict), 401
logger.info("Adding curation for statement %s." % hash_val)
ev_hash = request.json.get('ev_hash')
tag = request.json.get('tag')
text = request.json.get('text')
ev_json = request.json.get('ev_json')
try:
res = submit_curation(hash_val, tag, email, text, source='EMMAA',
ev_hash=ev_hash, ev_json=ev_json,
Expand Down

0 comments on commit d74d816

Please sign in to comment.