Skip to content

Instantly share code, notes, and snippets.

@joncle
Forked from skipallmighty/gist:8c08423efeaa7b8b6a51
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joncle/551c957e63b1039c49ba to your computer and use it in GitHub Desktop.
Save joncle/551c957e63b1039c49ba to your computer and use it in GitHub Desktop.
@blueprint.route("/repl/run/", methods=["POST"])
def repl_run():
import subprocess
if 'code' in request.form:
run_this = request.form['code']
run_this = run_this.replace('\n',';').replace('/\r/',';')
try:
return subprocess.check_output(['python', '-c', 'print 1 + r'])
except subprocess.CalledProcessError as e:
return e.output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment