Flask Combined form and query string


Example

Flask also allows access to a CombinedMultiDict that gives access to both the request.form and request.args attributes under one variable.

This example pulls data from a form field name submitted along with the echo field in the query string.

Flask Example:

from flask import Flask, request

app = Flask(import_name=__name__)


@app.route("/echo", methods=["POST"])
def echo():

    name = request.values.get("name", "")
    to_echo = request.values.get("echo", "")

    response = "Hey there {}! You said {}".format(name, to_echo)

    return response

app.run()