28 lines
530 B
Python
28 lines
530 B
Python
import logging
|
|
|
|
import flask
|
|
|
|
from autopilot.ical import generate_ical
|
|
from autopilot.scrape import get_reservations
|
|
from autopilot.config import LOGGING_CONFIG
|
|
|
|
|
|
logging.config.dictConfig(LOGGING_CONFIG)
|
|
app = flask.Flask(__name__)
|
|
|
|
|
|
@app.route('/')
|
|
def health():
|
|
return "It works!"
|
|
|
|
|
|
@app.route('/schedule.ics')
|
|
def main():
|
|
reservations = get_reservations()
|
|
ical = generate_ical(reservations)
|
|
return flask.Response(ical.serialize(), mimetype="text/calendar")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=True)
|