aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-03-25 11:52:41 -0700
committerGravatar MarkKoz <[email protected]>2019-03-25 11:52:41 -0700
commit3f679bf41341a2b2546ae667998bd5ea5d80e3fe (patch)
tree4ee747716f2998b55ae72ca87de17c2dbcfb2fa2
parentMerge remote-tracking branch 'remotes/origin/master' into rmq_removal (diff)
Add docstrings to routes
-rw-r--r--snekbox.py6
1 files changed, 6 insertions, 0 deletions
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)