mirror of
https://github.com/ail-project/ail-framework.git
synced 2025-01-31 06:26:14 +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
|
||||
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…
Add table
Reference in a new issue