Home > database >  Python rest api Put method throws 500
Python rest api Put method throws 500

Time:12-16

I have following python code

https://github.com/salikhanan/my_login_testing/blob/master/login_app/api.py

Here when a put request is made to update user data It throws

<title>500 Internal Server Error</title>

while it works fine when a get request is made to retrieve data for a single user. Can someone see what is wrong with PUT ? I would really appreciate it. I saw this project online to learn automation but I got myself stuck with this error.

CodePudding user response:

The 500 is probably due to an exception being raised and not caught in your application code. You should run your app in development mode:

export FLASK_ENV=development

.. then start the server with flask run. Now when you get the error, you will see in the browser a traceback pointing out the exact statement which is raising an exception.

  • Related