#!/usr/bin/env python3 import logging from flask import Flask, Response from rss import buildRSS from zdf import zdf app = Flask(__name__) app.secret_key = "NMcgoB.0wd+$.KVKj!F{3>U{%BBUVhL=7=5$:46rQH$Q{enCuU" def rssResponse(data): rss = buildRSS(data) response = Response(rss, mimetype="text/xml") response.headers["Access-Control-Allow-Origin"] = "*" return response @app.route("/") def main(): return "this is sparta" @app.errorhandler(404) def not_found(e): return "Die angeforderte Seite konnte nicht gefunden werden." @app.route("/zdf/") def fetch_zdf_show(show_url): return rssResponse(zdf(show_url)) if __name__ == "__main__": logging.basicConfig(filename="./main.log", level=logging.INFO) app.config["TEMPLATES_AUTO_RELOAD"] = True app.run(threaded=True)