from flask import Flask, jsonify, Response, request from game import Game app = Flask(__name__) my_game = Game() @app.route('/question', methods=['GET']) def get_question(): my_game.get_question() return jsonify(my_game.question) @app.route('/teamsize', methods=['POST']) def teamsize(): team_size = request.json my_game.set_teamsize(team_size.get('teamsize')) return Response(status=200) @app.route('/scoreboard', methods=['GET']) def scoreboard(): return my_game.scoreboard, Response(status=200) @app.route('/check', methods=['GET']) def check(): return my_game.scoreboard @app.route('/reset', methods=['GET']) def reset(): my_game.reset_game() return Response(status=200) @app.route('/scores', methods=['POST']) def get_scores(): scores = request.json my_game.add_score(scores) return Response(status=200) def main(): ## ASUS Router # app.run(host='192.168.50.79', port=5555, debug=True) ## Postman app.run(host='127.0.0.1', port=5555, debug=True) if __name__ == '__main__': main()