mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
Type fixed
This commit is contained in:
parent
e66b7aa19a
commit
dd9cee83db
1 changed files with 3 additions and 3 deletions
|
@ -226,17 +226,17 @@ def get_item(request_dict):
|
||||||
|
|
||||||
# API as txt
|
# API as txt
|
||||||
def get_item_as_txt(request_dict):
|
def get_item_as_txt(request_dict):
|
||||||
|
item_id = request_dict.get('id', None)
|
||||||
|
|
||||||
if not request_dict:
|
if not request_dict:
|
||||||
return {'status': 'error', 'reason': 'Malformed JSON'}, 400
|
return {'status': 'error', 'reason': 'Malformed JSON'}, 400
|
||||||
item_id = request_dict.get('id', None)
|
|
||||||
if not item_id:
|
if not item_id:
|
||||||
return {'status': 'error', 'reason': 'Mandatory parameter(s) not provided'}, 400
|
return {'status': 'error', 'reason': 'Mandatory parameter(s) not provided'}, 400
|
||||||
if not exist_item(item_id):
|
if not exist_item(item_id):
|
||||||
return {'status': 'error', 'reason': 'Item not found'}, 404
|
return {'status': 'error', 'reason': 'Item not found'}, 404
|
||||||
|
|
||||||
item_content = get_item_content(item_id)
|
item_content = get_item_content(item_id)
|
||||||
encoded_item_content = item_content.encode("UTF-8")
|
base64_output = base64.b64encode(item_content)
|
||||||
base64_output = base64.b64encode(encoded_item_content)
|
|
||||||
dict_item = {'id': item_id, 'content': base64_output}
|
dict_item = {'id': item_id, 'content': base64_output}
|
||||||
|
|
||||||
return dict_item, 200
|
return dict_item, 200
|
||||||
|
|
Loading…
Reference in a new issue