the interface written with Flask, you want to click on the string on the page, and then return the string to python,python after processing, and then return it to the front end, which is displayed on a blank page. I just came into contact with flask. I still don"t understand. I"d like to ask you how to do it.
I want to click on the agent below, and then after python has processed it, I return the details of the agent in the space on the right.
question 1: how to do this?
question 2: if I don"t update the same interface, do I want to use url_for to construct an interface for each proxy string? how do I do that?
Code for html view
/ / want to display the details of the agent on the same page < div id= "section_2" > < / div? Place
<div id="section_header">
<h3 align="right"> Current date/time: {{ current_time | datetimefilter }}</h3>
</div>
<div id="section_1">
<P align="right"> : </P>
{% for proxy in IP_PORT %}
<p align="right"><a href="-sharp">{{proxy}} {{IP_PORT[proxy]}}</a>
{% endfor %}
</div>
<div id="section_2">
</div>
</div>
here is the code in python
/ / the data is taken from Redis, and the function for handling the agent is in another file
.@app.route("/proxypool_list")
def proxypool_list():
redis = RedisClient()
proxy_list = redis.list()
proxy_list = sorted(proxy_list, key=lambda x : x[1],reverse=True)
IP = [proxy_list[i][0] for i in range(0,len(proxy_list))]
PORT = [proxy_list[i][1] for i in range(0,len(proxy_list))]
IP_PORT = dict(zip(IP, PORT))
return render_template(
"proxypool_list.html",IP_PORT=IP_PORT,current_time=current_time)