diff options
Diffstat (limited to 'snekbox.py')
-rw-r--r-- | snekbox.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -109,11 +109,15 @@ log = app.logger @app.route('/') def index(): + """Return a page with a form for inputting code to be executed.""" + return render_template('index.html') @app.route('/result', methods=["POST", "GET"]) def result(): + """Execute code and return a page displaying the results.""" + if request.method == "POST": code = request.form["Code"] output = snekbox.python3(code) @@ -122,6 +126,8 @@ def result(): @app.route('/input', methods=["POST"]) def code_input(): + """Execute code and return the results.""" + body = request.get_json() output = snekbox.python3(body["code"]) return jsonify(input=body["code"], output=output) |