Python Flask-Restful POST not taking JSON arguments

后端 未结 4 803
难免孤独
难免孤独 2020-12-23 14:29

I am very new to Flask (& Flask-Restful).

My problem : json arguments for a POST is getting set to NONE (not working).

4条回答
  •  时光说笑
    2020-12-23 15:14

    According to the documentation for Request.json and the new Request.get_json, you should have the mimetype on your POST request set to application/json. This is the only way flask will automatically parse your JSON data into the Request.json property which (I believe) is what Flask-Restful depends on to retrieve JSON data.

    NOTE: The newer get_json function has an option to force the parsing of POST data as JSON irrespective of the mimetype

提交回复
热议问题