Flask POST request is causing server to crash

The server is overloaded because the default port(5000) or port explicitly mentioned by a user(eg:app.run(port=7000)) may be using some other processes in the background, so we need to kill the processes which are being used by that port.

You can see the process id's(PIDS) which are using that port by using the following command: netstat -o -a in command prompt enter image description here *Look into the respective PID for the port

Then kill all the Processes(PIDS) for the port you want to use using the following command: Taskkill /PID 30832 /F Here I used the PID 30832 for port 127.0.0.1:7000 which is giving the overloaded error. After that problem is solved.


First what you want to do is enable debug mode so Flask will actually tell you what the error is. (And you get the added benefit of flask reloading every time you modify your code!)

if __name__ == '__main__':
    app.debug = True
    app.run()

Then we find out our error:

TypeError: 'dict' object is not callable

You're returning request.json, which is a dictionary. You need to convert it into a string first. It's pretty easy to do:

def api_response():
    from flask import jsonify
    if request.method == 'POST':
        return jsonify(**request.json)

There you are! :)