From 084da2eee54bdae3a44a77a37e947b37ee00f163 Mon Sep 17 00:00:00 2001 From: Ahmad Bilal Khalid Date: Tue, 2 Jul 2019 12:45:13 +0500 Subject: [PATCH] Make message more clear if file is not found in create_image_from_file view and added gunicorn --- Pipfile | 1 + Pipfile.lock | 10 +++++++++- main.py | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index ef8427e..daeed8a 100644 --- a/Pipfile +++ b/Pipfile @@ -12,6 +12,7 @@ requests = "*" flask = "*" flask-restful = "*" etcd3 = "*" +gunicorn = "*" [requires] python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index cccb1b6..86ac1a7 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "8793670eeaec12ab75f38686e67ba0c4f7d27a7b6da26d9c692b55621c865f63" + "sha256": "87f5447c7fa8d96dacc7c638075cc31842ef676f6d1c35214e1960572d44e929" }, "pipfile-spec": 6, "requires": { @@ -104,6 +104,14 @@ ], "version": "==1.21.1" }, + "gunicorn": { + "hashes": [ + "sha256:aa8e0b40b4157b36a5df5e599f45c9c76d6af43845ba3b3b0efe2c70473c2471", + "sha256:fa2662097c66f920f53f70621c6c58ca4a3c4d3434205e608e121b5b3b71f4f3" + ], + "index": "pypi", + "version": "==19.9.0" + }, "idna": { "hashes": [ "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", diff --git a/main.py b/main.py index 19ca6cb..624eaa5 100644 --- a/main.py +++ b/main.py @@ -101,7 +101,9 @@ class CreateImage(Resource): file_entry = client.get(f"/v1/files/{image_file_uuid}") if file_entry is None: - return {"Message": "Image File Not Found"}, 400 + return { + "Message": + f"Image File with uuid '{image_file_uuid}' Not Found"}, 400 file_entry_value = json.loads(file_entry.value)