Use a CSV file to populate a webpage that display the latest weather using flask? Use a CSV file to populate a webpage that display the latest weather using flask? flask flask

Use a CSV file to populate a webpage that display the latest weather using flask?


I think you're looking for send_file(). The flask endpoint would look something like:

from flask import Flask, send_fileapp = Flask(__name__)app.debug = True# Your get_information method@app.route("/weather.csv")def weather():    url = "http://api.wunderground.com/api/8d3b5d3fa03ddb6f/conditions/weather/q/China/Beijing.json"    get_information(url)    return send_file("out.csv")if __name__ == '__main__':    app.run()