#导入Flask框架模块及其他模块,代码略
app =Flask _name_ )
@app.route("/input")
def add_data():
id =int(request.args.get(id'))
value =float(request args.get(val'))
nowtime =datetime.datetime.now()
nowtime =nowtime.strftime('%Y-%m-%d %H:%M:%S')
db=sqlite3.connect("data.db")
cur=db.cursor()
cur.execute("INSERT INTO sensorlog(id,sensorvalue,updatetime)VALUES(%d,%f,'%s)" %(id,value,nowtime))
db.commit()
cur.close()
db.close()
#服务器其他功能,代码略
if _name_ =="_main_ ":
app.run(host="6.56.102.4",port=8080)
请回答下列问题