diff options
Diffstat (limited to 'api/views.py')
-rw-r--r-- | api/views.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/api/views.py b/api/views.py index e78389f5a..7357625e0 100644 --- a/api/views.py +++ b/api/views.py @@ -14,6 +14,7 @@ from flask_restful import Resource from api.utils import common as common_utils from api.actions import test as test_action from api.actions import result as result_action +from api.actions import env as env_action logger = logging.getLogger(__name__) @@ -40,3 +41,15 @@ class Result(Resource): return getattr(result_action, action)(args) except AttributeError: return common_utils.error_handler('Wrong action') + + +class Env(Resource): + def post(self): + action = common_utils.translate_to_str(request.json.get('action', '')) + args = common_utils.translate_to_str(request.json.get('args', {})) + logger.debug('Input args is: action: %s, args: %s', action, args) + + try: + return getattr(env_action, action)(args) + except AttributeError: + return common_utils.error_handler('Wrong action') |