
上QQ阅读APP看书,第一时间看更新
A simple GET/POST request
An amalgamation of both GET and POST into a single view function can be written as shown below:
@app.route('/a-request', methods=['GET', 'POST']) def some_request(): if request.method == 'GET': bar = request.args.get('foo', 'bar') else: bar = request.form.get('foo', 'bar') return 'A simple Flask request where foo is %s' % bar