From 3f679bf41341a2b2546ae667998bd5ea5d80e3fe Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Mon, 25 Mar 2019 11:52:41 -0700 Subject: Add docstrings to routes --- snekbox.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'snekbox.py') diff --git a/snekbox.py b/snekbox.py index 5946e12..bb04987 100644 --- a/snekbox.py +++ b/snekbox.py @@ -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) -- cgit v1.2.3