Add explicit variable types
This commit is contained in:
parent
23085de24e
commit
98d2c082ee
@ -1,4 +1,4 @@
|
|||||||
from flask import Flask, request, render_template
|
from flask import Flask, request, render_template, redirect, url_for
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
@ -16,7 +16,7 @@ def success():
|
|||||||
def main_page():
|
def main_page():
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
|
||||||
@app.route('/add_time', methods=['POST'])
|
@app.route('/add_time', methods=['POST', 'GET'])
|
||||||
def add_time():
|
def add_time():
|
||||||
# database = request.form['db']
|
# database = request.form['db']
|
||||||
# table = request.form['table']
|
# table = request.form['table']
|
||||||
@ -33,11 +33,11 @@ def add_time():
|
|||||||
"time": date + "T" + time + "Z",
|
"time": date + "T" + time + "Z",
|
||||||
"measurement": "odyssey",
|
"measurement": "odyssey",
|
||||||
"fields": {
|
"fields": {
|
||||||
"odometer": odometer,
|
"odometer": float(odometer),
|
||||||
"oilhealth": oilhealth,
|
"oilhealth": oilhealth,
|
||||||
"fuel": fuel,
|
"fuel": fuel,
|
||||||
"fuelcost": fuelcost,
|
"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')
|
@app.route('/admin')
|
||||||
def admin_index():
|
def admin_index():
|
||||||
|
@ -6,7 +6,6 @@ influxdb==4.0.0
|
|||||||
itsdangerous==0.24
|
itsdangerous==0.24
|
||||||
Jinja2==2.8
|
Jinja2==2.8
|
||||||
MarkupSafe==0.23
|
MarkupSafe==0.23
|
||||||
pkg-resources==0.0.0
|
|
||||||
python-dateutil==2.6.0
|
python-dateutil==2.6.0
|
||||||
pytz==2016.10
|
pytz==2016.10
|
||||||
requests==2.12.4
|
requests==2.12.4
|
||||||
|
Loading…
Reference in New Issue
Block a user