From f065856c67dcd8e6c88cfa454fe2596c024284f4 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 4 Oct 2017 20:49:03 +0300 Subject: Add: /version to controller API --- ick2/controllerapi.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ick2/controllerapi.py') diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py index 70877f1..ef93f54 100644 --- a/ick2/controllerapi.py +++ b/ick2/controllerapi.py @@ -17,6 +17,7 @@ import apifw import ick2 +import ick2version class ControllerAPI: @@ -35,6 +36,11 @@ class ControllerAPI: def find_missing_route(self, path): # pragma: no cover return [ + { + 'method': 'GET', + 'path': '/version', + 'callback': self.get_version, + }, { 'method': 'POST', 'path': '/projects', @@ -62,6 +68,17 @@ class ControllerAPI: }, ] + def get_version(self, *args, **kwargs): + return apifw.Response({ + 'status': apifw.HTTP_OK, + 'body': { + 'version': ick2version.__version__, + }, + 'headers': { + 'Content-Type': 'application/json', + }, + }) + def get_callback(self, callback): # pragma: no cover def wrapper(content_type, body, **kwargs): try: -- cgit v1.2.1