From 1617b60ea6e6637f684616c04924becc8f394846 Mon Sep 17 00:00:00 2001 From: Sunpy Date: Wed, 23 May 2018 22:59:21 +0200 Subject: [PATCH] Added api endpoint --- handlers/update.py | 2 ++ templates/api.html | 1 + web.py | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 handlers/update.py create mode 100644 templates/api.html diff --git a/handlers/update.py b/handlers/update.py new file mode 100644 index 0000000..b8684ce --- /dev/null +++ b/handlers/update.py @@ -0,0 +1,2 @@ +def handle(request): + return "Unimplemented" \ No newline at end of file diff --git a/templates/api.html b/templates/api.html new file mode 100644 index 0000000..6150190 --- /dev/null +++ b/templates/api.html @@ -0,0 +1 @@ +Unimplemented \ No newline at end of file diff --git a/web.py b/web.py index 074c86e..406d0d8 100644 --- a/web.py +++ b/web.py @@ -2,20 +2,29 @@ import json import MySQLdb import MySQLdb.cursors from flask import Flask, make_response, request, render_template, jsonify +from handlers import update app = Flask(__name__) with open("config.json", "r") as f: - config = json.load(f) + config = json.load(f) @app.route("/") @app.route("/home") def home_index(): - return render_template("index.html") + return render_template("index.html") @app.route("/download") def download_index(): - return render_template("download.html") + return render_template("download.html") + +@app.route("/api") +def api_index(): + return render_template("api.html") + +@app.route("/api/getUpdate", methods=["GET", "POST"]) +def api_update(): + return update.handle(request) if __name__ == "__main__": - app.run(**config["web"]) \ No newline at end of file + app.run(**config["web"]) \ No newline at end of file