def mapGoogle(): """ googlemap Part This view, is made to recieve data from the front end logic, traite it with the methods in backend's logic with a final tamplates containing the map... """ if request.method == "POST": # cheking request type question = request.json # recieve the question from the form in the FE query = bot.Bot(question) # sending the question to the back end mapResponse = query.GooglMaplink() return jsonify(mapResponse) # jesonify the response from the server else: return render_template("index.html")
def mediaResult(): """ Mediawiki Part This view, is made to recieve data from the front end logic, traite it with the methods in backend's logic with a final tamplates... """ if request.method == "POST": question = request.json query = bot.Bot(question) mediaResponse = query.media_Wiki_Resp() return jsonify(mediaResponse) else: return render_template("index.html")
import falcon import os import sys CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append('/'.join(i for i in CWD.split('/')[:-1])) from app import bot #from app.middlewares.user import (UserMiddleware, ) #from app.middlewares.database import (DatabaseMiddleware, ) class App(falcon.API): """ Base App linking WSGI and Falcon Framework """ def __init__(self, bott, *args, **kwargs): super(App, self).__init__(*args, **kwargs) self.add_route('/bot', bott) #middleware = [DatabaseMiddleware(), UserMiddleware()] bott = bot.Bot() #application = App(bott, middleware=middleware) application = App(bott) if __name__ == "__main__": # For testing on local from tools import test_core as testing testing.run_application()
from flask import render_template, request, redirect, url_for from flask import jsonify from app import app from app import calibration, bot from app.lookups import PATTERNS import base64 cal = calibration.Calibration() mybot = bot.Bot(cal) @app.route('/') @app.route('/index') def index(): return render_template('index.html', title='Main Menu') @app.route('/scan') def scan(): image = mybot.get_imagestream() img = base64.b64encode(image.getvalue()).decode('utf-8') return render_template('scan.html', title='Scan', img=img) @app.route('/solve') def solve(): return render_template('solve.html', title="Solve", solve_images=PATTERNS) @app.route('/update_solve', methods=['POST']) def update_solve():