<s>[INST] How can I get the whole request POST body in Python with Flask? I want to be able to get the whole POST body of the request as a string or file handle that I can read but I'm unable to find a way (I'm new to Flask and Python for web at all). This is what I got:
from flask import Flask

app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def parse_request():
    # obtain the whole post body here, in case the request is post...

AS THIS QUESTION IS GETTING MANY VIEWS:
The answer to the question linked below is telling a way that works only if the content-type is not recognised, this one instead is asking how to get the whole raw post body regardless of the headers:
Get raw POST body in Python Flask regardless of Content-Type header
 [/INST] The docs describe the attributes available on the request.  In most common cases request.data will be empty because it's used as a fallback:

request.data Contains the incoming request data as string in case it came with a mimetype Flask does not handle.


request.args: the key/value pairs in the URL query string
request.form: the key/value pairs in the body, as sent by a HTML POST form
request.files: the files in the body, which Flask keeps separate from form
request.values: combined args and form, preferring args if keys overlap

 </s>