【发布时间】:2023-03-31 00:30:01
【问题描述】:
我正在尝试在 Flask 中链接一个 url,但找不到问题的解决方案。我的想法是根据我网页中给出的参数在 UniProt 中搜索蛋白质。例子是:
@app.route('/http.html')
def http():
return render_template('http.html')
@app.route('/http_results', methods=['POST'])
def http_results():
protname_seq = request.form['protname_seq']
specie_seq = request.form['specie_seq']
input_text = seqtools.httplink(protname_seq,specie_seq)
return render_template('http_results.html', **locals())
在seqtools我有一个具有以下功能的python代码:
def httplink(prot,specie):
a=prot
b='_'+specie
c=print('http://www.uniprot.org/uniprot/?query=',a+b,'&sort=score')
return c
现在在http_results.html 中我尝试了多种方法,但最终结果是None 或错误,所以我真的不知道如何继续。 http_results.html 代码是:
{% extends "layout.html" %}
{% block body %}
<div>
<p>The link to the protein is:</p>
<p><a href={{input_text}}>{{ protname_seq }}</a></p>
<br>
</div>
{% endblock %}
只需要链接到 UniProt 网页的蛋白质名称。感谢您的帮助,对不起我的英语。
【问题讨论】: