July 2019
Beginner to intermediate
302 pages
9h 38m
English
The following is a simple example of what a GET request looks like.:
@app.route('/a-get-request')
def get_request():
bar = request.args.get('foo', 'bar')
return 'A simple Flask request where foo is %s' % bar
Here, we just check whether the URL query has an argument called foo. If yes, we display this in the response; otherwise, the default is bar.