/gist:551c957e63b1039c49ba Secret
Last active
August 29, 2015 14:05
-
-
Save joncle/551c957e63b1039c49ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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