8 from flask import current_app, jsonify, request
\r
11 from app.errors.bad_request_exception import BadRequestException
\r
12 from app.helpers.time_helper import unix_time_millis, timed_function
\r
13 from app.helpers.response_helper import vth_response_dic
\r
14 from app.helpers import response_helper as ResponseHelper
\r
15 from app.helpers import action_helper as Info
\r
16 from . import config, ROUTES
\r
19 @ROUTES.route("/handle_action", methods=['POST'])
\r
20 def handle_action_request():
\r
21 return ResponseHelper.route_check(config=config, post_function = Info.execute_action)
\r
24 @ROUTES.route("/", methods=['GET'])
\r
31 current_app.logger.info(request.method)
\r
32 response = vth_response_dic()
\r
33 data = current_app.url_map
\r
36 for rule in data.iter_rules():
\r
38 for val in rule.methods:
\r
39 if (val != "OPTIONS") and (val !="HEAD"):
\r
41 ma[rule.rule].append(val)
\r
44 # methods_set.add(rule.methods)
\r
45 #print(rule.methods)
\r
47 response["vthResponse"]["resultData"] = rules
\r
48 #current_app.logger.info(current_app.url_map)
\r
49 current_app.logger.debug("hit health point")
\r
50 return jsonify(response)
\r
52 @ROUTES.route("/health", methods=['GET'])
\r
59 current_app.logger.debug("hit health point")
\r
62 @ROUTES.route("/status", methods=['GET'])
\r
69 suma = lambda: time.sleep(1)
\r
70 #current_app.logger.info(current_app.url_map)
\r
71 current_app.logger.info(unix_time_millis(datetime.datetime.now()))
\r
72 current_app.logger.info(timed_function(suma))
\r
73 current_app.logger.debug("some stuff")
\r
74 #raise Exception("some error")
\r
75 raise BadRequestException()
\r