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 065de673b..f899251dd 100644 --- a/api/views.py +++ b/api/views.py @@ -13,6 +13,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 samples as samples_action from api.actions import result as result_action from api.actions import env as env_action @@ -31,6 +32,18 @@ class Release(Resource): return common_utils.error_handler('Wrong action') +class Samples(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(samples_action, action)(args) + except AttributeError: + return common_utils.error_handler('Wrong action') + + class Results(Resource): def get(self): args = common_utils.translate_to_str(request.args) |