示例#1
0
	def delete_all():
		# Init
		returnValue = True

		# Execution
		HistoricPressureModel.delete_all()
		HistoricHumidityModel.delete_all()
		HistoricCO2Model.delete_all()
		HistoricTemperatureModel.delete_all()

		# Clean and return
		return returnValue
示例#2
0
def historic_co2_reset():
    logging.debug("Received request /historic/co2/reset")
    startTime = time.monotonic()
    try:
        # Requires a simple pw
        pw = req.args.get("pw")
        logging.debug("pw arg is: " + str(pw))
        if pw != "A7G2V9":
            abort(403)

        HistoricCO2Model.delete_all()
        elapsedTime = time.monotonic() - startTime
        logging.debug("co2 reset request time: " + str(round(elapsedTime, 5)) +
                      " seconds")
        return res(204, timeUTC=datetime.utcnow())
    except mariadb.Error as e:
        abort(500, str(e))