def _dump_history(): try: dump_history() ret, response = True, "Success" except Exception: ret, response = False, "Failure" return Response(json_encode({ 'ret': ret, 'response': response }), mimetype="application/json")
def _dump_history(): try: dump_history() ret, response = True, "Success" except Exception: ret, response = False, "Failure" return Response(json_encode({ 'ret': ret, 'response': response }), mimetype="application/json")
def _stats(): try: data = request.args days = int(data.get('lookback', 7)) dump_history() response = history_stats(HISTORY_DIR, days) ret = True except Exception as ex: ret, response = False, {'err_msg': str(ex)} logger.error(ex) return Response(json_encode({'ret': ret, 'response': response}), mimetype="application/json")
def _stats(): try: data = request.args days = int(data.get('lookback', 7)) dump_history() response = history_stats(HISTORY_DIR, days) ret = True except Exception as ex: ret, response = False, {'err_msg': str(ex)} logger.error(ex) return Response(json_encode({'ret': ret, 'response': response}), mimetype="application/json")