response_analysis.py 1.81 KB
Newer Older
李明杰's avatar
李明杰 committed
1 2 3 4
# -*- coding: utf-8 -*-
# author:Li Mingjie time:2019/3/7
# Brief:

李明杰's avatar
李明杰 committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
# import json
# from flask import Flask
# from flask import request
# from flask_cors import CORS
# import response_time_analysis
# import response_error_analysis
#
# app = Flask(__name__)
# CORS(app, supports_credentials=True)
#
#
# @app.route('/SPDAS/response_analysis1', methods=['POST'])
# def domain():
#     param = ({"data_type": [{"value": "control"}, {"value": "application"}, {"value": "all"}],
#               "effect_type": [{"value": "cost_time"}, {"value": "response_error"}],
#               "time": "2018-12-01 00:00:00/2018-12-02 00:00:00"})
#     return json.JSONEncoder().encode(param)
#
#
# @app.route('/SPDAS/response_analysis2', methods=['POST'])
# def domain_form():
#     # 需要从request对象读取表单内容:
#     data = request.get_data()
#     json_re = json.loads(data)
#     datatype = json_re['data_type']
#
#     effecttype = json_re['effect_type']
#     m_time = json_re['time']
#     str_time = str(m_time)
#     m_time = str_time.split('/')
#     starttime = m_time[0]
#     endtime = m_time[1]
#     if effecttype == 'cost_time':
#         image_path = response_time_analysis.cost_time_plot(datatype=datatype, starttime=starttime, endtime=endtime)
#         path = ({"response_image": image_path})
#         return json.JSONEncoder().encode(path)
#     else:
#         image_path = response_error_analysis.error_data_statistics_plot(datatype=datatype, starttime=starttime,
#                                                                         endtime=endtime,
#                                                                         graphtype='bar')
#         path = ({"response_image": image_path})
#         return json.JSONEncoder().encode(path)
#
#
# if __name__ == '__main__':
#     app.run(debug=True, host='10.7.19.129', port=5000)