From 98d2c082ee9bc52d02b12f26e5e1a3c350c8e539 Mon Sep 17 00:00:00 2001 From: Gogs Date: Sat, 28 Jan 2017 02:09:09 -0500 Subject: [PATCH] Add explicit variable types --- influx_frontend.py | 10 +++++----- requirements.txt | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/influx_frontend.py b/influx_frontend.py index cddb47f..354580b 100644 --- a/influx_frontend.py +++ b/influx_frontend.py @@ -1,4 +1,4 @@ -from flask import Flask, request, render_template +from flask import Flask, request, render_template, redirect, url_for app = Flask(__name__) from influxdb import InfluxDBClient @@ -16,7 +16,7 @@ def success(): def main_page(): return render_template('index.html') -@app.route('/add_time', methods=['POST']) +@app.route('/add_time', methods=['POST', 'GET']) def add_time(): # database = request.form['db'] # table = request.form['table'] @@ -33,11 +33,11 @@ def add_time(): "time": date + "T" + time + "Z", "measurement": "odyssey", "fields": { - "odometer": odometer, + "odometer": float(odometer), "oilhealth": oilhealth, "fuel": fuel, "fuelcost": fuelcost, - "winter": winter + "winter": bool(winter) } } ] @@ -49,7 +49,7 @@ def add_time(): - return render_template('index.html') + return redirect(url_for('main_page')) @app.route('/admin') def admin_index(): diff --git a/requirements.txt b/requirements.txt index 6304d73..ecb08d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ influxdb==4.0.0 itsdangerous==0.24 Jinja2==2.8 MarkupSafe==0.23 -pkg-resources==0.0.0 python-dateutil==2.6.0 pytz==2016.10 requests==2.12.4