Answers for "difference between get and post in flask"

1

flask post vs get

@app.route("/login", methods=["POST", "GET"])
def login():
    if request.method == "POST":
        user = request.form["name"]
        return redirect(url_for("success", name=user))
    else:
        user = request.args.get("name")
        return redirect(url_for("success", name=user))
Posted by: Guest on July-16-2021

Python Answers by Framework

Browse Popular Code Answers by Language