def get(self): if request.method == 'GET': log_data = request.args.to_dict() if log_data: logger = log.Log() logger.tid = log_data['tid'] logger.write_to_log(log_data['t1'], log_data['t2'], log_data['d1'], log_data['d2'], log_data["data"]) return cors_data("success")
def get_request_data(): if request.method == 'GET': str_data = request.args.items() dict_data = dict(str_data) tid = dict_data['tid'] # 记录除了tid之后接收到的数据 logger = log.Log() logger.tid = tid return dict_data
def get(self): dict_data = get_request_data() logger = log.Log() logger.write_to_log('OPRT', 'ROUTE', '/resource/show/oprt', dict_data['ip'], '') if get_all_node(): logger.write_to_log('DATA', 'RETURN', 'OprtResource', 'result', '0') return cors_data("0") else: logger.write_to_log('DATA', 'RETURN', 'OprtResource', 'result', '1') return cors_data("1")
def get(self): dict_data = get_request_data() logger = log.Log() logger.write_to_log('OPRT', 'ROUTE', '/storagepool/show/oprt', dict_data['ip'], '') if get_all_storagepool(): logger.write_to_log('DATA', 'RETURN', 'OprtStoragepool', 'result', '0') return cors_data("0") else: logger.write_to_log('DATA', 'RETURN', 'OprtStoragepool', 'result', '1') return cors_data("1")
# -*- coding: utf-8 -*- from mgt_app import create_app #from public import log import sys sys.path.append("..") from public import log app = create_app() log.Log.filename = log.WEB_LOG_NAME logger = log.Log() app = create_app() if __name__ == '__main__': app.run( host='0.0.0.0', # 任何ip都可以访问 port=7773, # 端口 debug=True)