The response text from my API call shows in the logs but how can I display one of the values from the output. For example the below returns the result.
{"uuid":"FqDSDSVJY+GYAHSTSGA=","id":6238236373}
I am wanting to render "6238236373" on my index.html page. What is the best option to convert to valid json objects and then call these objects onto my page?
app.py
@app.route('/alert', methods=['GET', 'POST'])
def alert():
form = ReusableForm(request.form)
if request.method == 'GET':
import requests
url = "https://xxxxxxxxxxxxxxxxxxxxx.com/api/v1"
payload="{}"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json, application/xml',
'Authorization': 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
return render_template('index.html', form=form,)
index.html
<html>
<body>
{ render id response }
</body>
</html>