From 6383fbab458e2c1f86ecf4220c614a301a9435cb Mon Sep 17 00:00:00 2001 From: Matthias Schaub Date: Thu, 12 Oct 2023 11:15:45 +0200 Subject: [PATCH] feat(api): respond w/ task.status instead of custom --- sketch_map_tool/routes.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sketch_map_tool/routes.py b/sketch_map_tool/routes.py index 215868ed..9be22c13 100644 --- a/sketch_map_tool/routes.py +++ b/sketch_map_tool/routes.py @@ -164,7 +164,6 @@ def status(uuid: str, type_: REQUEST_TYPES) -> Response: if task.ready(): if task.successful(): # SUCCESS http_status = 200 - status = "SUCCESSFUL" href = "/api/download/" + uuid + "/" + type_ elif task.failed(): # REJECTED, REVOKED, FAILURE try: @@ -173,19 +172,16 @@ def status(uuid: str, type_: REQUEST_TYPES) -> Response: # The request was well-formed but was unable to be followed due # to semantic errors. http_status = 422 # Unprocessable Entity - status = "FAILED" error = str(err) except (Exception) as err: http_status = 500 # Internal Server Error - status = "FAILED" error = str(err) - else: # PENDING, RETRY, RECEIVED, STARTED + else: # PENDING, RETRY, STARTED # Accepted for processing, but has not been completed http_status = 202 # Accepted - status = "PROCESSING" body_raw = { "id": uuid, - "status": status, + "status": task.status, "type": type_, "href": href, "error": error,