I am new to Flask and even though I have read through the documentation, I am still very confused on the relationship between Python functions and HTML. Specifically, I am unsure of how a function can be called within an HTML page. For example, I have the following code on my route.py file:
from flask import Flask, render_template
import requests
app = Flask(__name__)
@app.route('/placement_debugger')
def placementDebugger():
return render_template('placement_debugger.html')
def get_data():
return requests.get('http://example.com'+placementID).content
Here is the code from my "placement_debugger.html" file. Basically, I am trying to obtain an ID from a user and use that ID within an HTTP GET request:
<p1>
<form action="/action_page.php">
<strong>Placement ID: </strong><input type="text" name="Placement ID"
value=""><br>
<input type="submit" value="Submit">
</form>
</p1>
How can I call my "get_data()" function within the "placement_debugger.html" page?