I have a function that analyzes a CSV file with Pandas and produces a dict with summary information. I want to return the results as a response from a Flask view. How do I r
To return a JSON response and set a status code you can use make_response:
make_response
from flask import jsonify, make_response @app.route('/summary') def summary(): d = make_summary() return make_response(jsonify(d), 200)
Inspiration taken from this comment in the Flask issue tracker.