mirror of https://github.com/CIRCL/AIL-framework
Type fixed
parent
e66b7aa19a
commit
dd9cee83db
|
@ -226,17 +226,17 @@ def get_item(request_dict):
|
|||
|
||||
# API as txt
|
||||
def get_item_as_txt(request_dict):
|
||||
item_id = request_dict.get('id', None)
|
||||
|
||||
if not request_dict:
|
||||
return {'status': 'error', 'reason': 'Malformed JSON'}, 400
|
||||
item_id = request_dict.get('id', None)
|
||||
if not item_id:
|
||||
return {'status': 'error', 'reason': 'Mandatory parameter(s) not provided'}, 400
|
||||
if not exist_item(item_id):
|
||||
return {'status': 'error', 'reason': 'Item not found'}, 404
|
||||
|
||||
item_content = get_item_content(item_id)
|
||||
encoded_item_content = item_content.encode("UTF-8")
|
||||
base64_output = base64.b64encode(encoded_item_content)
|
||||
base64_output = base64.b64encode(item_content)
|
||||
dict_item = {'id': item_id, 'content': base64_output}
|
||||
|
||||
return dict_item, 200
|
||||
|
|
Loading…
Reference in New Issue