Answers for "python handling a post request"

0

python handling a post request

# first do: pip install flask

from flask import Flask, request

app = Flask(__name__)

@app.route('/', methods=['POST'])
def result():
    print(request.data)  # raw data
    print(request.json)  # json (if content-type of application/json is sent with the request)
    print(request.get_json(force=True))  # json (if content-type of application/json is not sent)
Posted by: Guest on June-09-2021

Python Answers by Framework

Browse Popular Code Answers by Language