【发布时间】:2018-09-23 14:34:45
【问题描述】:
我想从 db info 创建一个 HTTP 链接。比如ip和端口号,不知何故我试过了,但一直出错,无法解析和端口希望任何人都可以帮助我
@app.route('/link_test/<string:id>')
@is_logged_in
def link_test(id):
#Create cursor
cur = mysql.get_db().cursor()
#get item by itemno
result = cur.execute("SELECT * FROM testlist WHERE id = %s", [id])
doc = cur.fetchone()
)
doc = {"id": test[0], "rdno": test[1], "ipno": test[2], "port": test[3]}
cur.close()
ipno = test['ipno']
port = test['port']
url_uptime = 'https://<string:ipno>:<string:port>/stats/uptime/'
return render_template('link_test.html', uptime=json.loads(r_uptime))
【问题讨论】:
-
我认为您会因为随机的
)字符而遇到错误,并且从未定义过test;。而且你没有解析任何东西。看起来您正在尝试格式化 URL