server.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:sleep-debugger 作者: mayhem 项目源码 文件源码
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")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号