I just starting working with Python and Flask. I created a basic rest and I won't to get data that I send using Postman. Data:
{
"username": "test",
"password": "12345"
}
My python code
from flask import Flask, request
...
@app.route("/Test", methods=['POST'])
def Test():
print(request.data)
...
I can see in the terminal that it prints b'{\n\t"username": "test",\n\t"password": "12345"\n}'
How can I get the values? I'm looking for something like:
request.data.username
request.data.password
How can I do it using python?
BTW, I tried to to request.json and it returned 'none'. Also, request.form returned 'ImmutableMultiDict([])'.
Thanks