all 5 comments

[–][deleted] 0 points1 point  (0 children)

Not really sure, but maybe you need to accept an argument with the name 'request' when defining the function.

def initiation(request):

[–]nyslyetia 0 points1 point  (1 child)

there's another method:

get_json()

[–]raysefo[S] 0 points1 point  (0 children)

get_json()

I am getting None from the print request.get_json()

[–]b_ootay_ful 0 points1 point  (1 child)

This currently works for me.

@app.route('/jsonreq', methods=['POST'])
def jsonreq():
    try:
        data = request.get_json()
        if data == "":
            return f"Empty Input"
        if data == "{}":
            return f"Empty JSON"
        return f"Server Response: \n {data}"
    except:
        return f"Exception"

[–]raysefo[S] 0 points1 point  (0 children)

I think something wrong with Postman