Quantcast
Channel: Serve an ical feed with Flask - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by pjcunningham for Serve an ical feed with Flask

$
0
0

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

Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>