def record():
txt = request.form['entry']
try:
influx = InfluxDBClient(config.INFLUX_HOST, config.INFLUX_PORT, config.INFLUX_USER, config.INFLUX_PASSWD, config.INFLUX_DB)
except Exception as err:
flash("Entry was not recorded. Influx connection error: %s" % str(err))
if influx:
json_body = [
{
"measurement": "notes",
"tags":
{
"sleeper": config.SLEEPER
},
"fields": { 'note' : txt }
}
]
try:
influx.write_points(json_body)
flash('Entry recorded.')
except Exception as err:
flash("Entry was not recorded. Influx write error: %s" % str(err))
return render_template("index")
评论列表
文章目录