You need to set the the correct content disposition header of the response. In your case the header would be something like the following:
Content-Disposition: attachment; filename=calender.ics;
In your Flask route your code should look something like the following:
from flask import make_responseapp = Flask(__name__)# ...@app.route('/calendar/')def calendar(): # Get the calendar data _calendar = make_calendar() # turn calendar data into a response response = make_response(_calendar) response.headers["Content-Disposition"] = "attachment; filename=calendar.ics" return response