Renamed handlers

This commit is contained in:
Emily 2018-05-31 10:59:36 +02:00
parent 55c99891d6
commit 4710e6ba7b
3 changed files with 4 additions and 6 deletions

View File

@ -1,6 +1,6 @@
from objects import glob from objects import glob
allowed_args = ["file_hash", "id", "file_version", "timestamp"] allowed_args = ["file_hash", "file_version", "timestamp"]
def handle(request): def handle(request):
if len([x for x in request.args if x in allowed_args]) == 0: if len([x for x in request.args if x in allowed_args]) == 0:

View File

@ -1,2 +0,0 @@
def handle(request):
return "Unimplemented"

6
web.py
View File

@ -2,7 +2,7 @@ import json
import MySQLdb import MySQLdb
import MySQLdb.cursors import MySQLdb.cursors
from flask import Flask, make_response, request, render_template, jsonify from flask import Flask, make_response, request, render_template, jsonify
from handlers import update, file from handlers import getupdate, getfile
from objects import glob from objects import glob
app = Flask(__name__) app = Flask(__name__)
@ -28,12 +28,12 @@ def api_index():
@app.route("/api/getUpdate", methods=["GET", "POST"]) @app.route("/api/getUpdate", methods=["GET", "POST"])
def api_update(): def api_update():
data = update.handle(request) data = getupdate.handle(request)
return jsonify(data) return jsonify(data)
@app.route("/api/getFile", methods=["GET", "POST"]) @app.route("/api/getFile", methods=["GET", "POST"])
def api_file(): def api_file():
data = file.handle(request) data = getfile.handle(request)
return jsonify(data) return jsonify(data)
if __name__ == "__main__": if __name__ == "__main__":