All checks were successful
continuous-integration/drone/push Build is passing
32 lines
788 B
Python
32 lines
788 B
Python
#!/usr/bin/env python3
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
from pathlib import Path
|
|
|
|
import datetime
|
|
|
|
import timetable_parser
|
|
from flask import Flask, make_response, render_template, request, send_file
|
|
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
|
|
|
|
@app.route('/', methods=['HEAD', 'OPTIONS', 'GET'])
|
|
def index():
|
|
return render_template('index.html', datetime=datetime)
|
|
|
|
|
|
@app.route('/favicon.ico', methods=['HEAD', 'OPTIONS', 'GET'])
|
|
def favicon():
|
|
return send_file(Path('favicon.ico'))
|
|
|
|
|
|
@app.route('/convert.ics', methods=['HEAD', 'OPTIONS', 'GET'])
|
|
def convert():
|
|
print(request.args.get('url'))
|
|
resp_text = 'works?'
|
|
resp = make_response(resp_text.encode('utf-8'), 200)
|
|
resp.mimetype = 'text/plain'
|
|
resp.mimetype_params['charset'] = 'utf-8'
|
|
return resp
|