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

        # Execution
        RecentPressureModel.delete_all()
        RecentHumidityModel.delete_all()
        RecentCO2Model.delete_all()
        RecentTemperatureModel.delete_all()

        # Clean and return
        return returnValue
Example #2
0
def recent_co2_reset():
	logging.debug("Received request /recent/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)
		
		RecentCO2Model.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))