I am using the following HTML code for form options:
<form action="/submit" method="POST">
<div class="form-group">
<h3>Section</h3>
<select name="articles">
<option value="">Select Section</option>
<option value="Business">Business</option>
<option value="Sport">Sports</option>
<option value="Culture">Culture</option>
<option value="Technology">Technology</option>
</select>
</div>
And the following python code:
url = 'https://api.nytimes.com/svc/topstories/v2/{section}.json?api-XXXX'
response1 = urllib.request.urlopen(url).read()
data = json.loads(response1.decode('utf-8').replace('\n', ''))
I am using Jinja2 and Flask and would like the {section} to be filled according to the option chosen by the user before submitting.
Thanks!