Flask API TypeError: Object of type 'Response' is not JSON serializable

后端 未结 4 1672
栀梦
栀梦 2021-02-12 11:41

i have a problem with Python Flask Restful API and data goes to Elasticsearch, when i post a new data with Postman, problem is:

TypeError: Object of type \'Response\' is

4条回答
  •  盖世英雄少女心
    2021-02-12 12:34

    Inspired from this bug, here is a shorter way of doing it:

    from flask import jsonify, make_response
    
    def myMethod():
        ....
        return make_response(jsonify(data), 200)
    

提交回复
热议问题