April 2018
Beginner
340 pages
7h 54m
English
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 ...