O'Reilly logo

Tkinter GUI Programming by Example by David Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending a POST request

A POST request allows us to send data over to the server which it can then process as it needs to. It is a common method for saving or updating data that is stored in a database on the server machine.

Let's try this out now; open up your server and add a new endpoint as follows:

from flask import Flask, jsonify, request...@app.route("/send_me_data", methods=["POST"])def send_me_data():    data = request.form    for key, value in data.items():        print("received", key, "with value", value)    return "Thanks"...

This function includes a second argument in the route decorator called methods.  This argument specifies the HTTP methods, which are allowed to be sent to this endpoint. Since we want to send data using a POST request, we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required