diff --git a/influx_frontend.py b/influx_frontend.py index f8930b7..ecba7cc 100644 --- a/influx_frontend.py +++ b/influx_frontend.py @@ -1,4 +1,6 @@ from flask import Flask, request, render_template, redirect, url_for +from time import strftime +import datetime app = Flask(__name__) from influxdb import InfluxDBClient @@ -18,10 +20,16 @@ def main_page(): @app.route('/add_time', methods=['POST', 'GET']) def add_time(): + today = strftime("%Y-%m-%d") + now = strftime("%H:%M:%S") # database = request.form['db'] # table = request.form['table'] date = request.form['date'] + if date == '': + date = today time = request.form['time'] + if time == '': + time = now odometer = request.form['odometer'] oilhealth= request.form['oilhealth'] fuel = request.form['fuel']