python-hard-way/Web/app.py

23 lines
594 B
Python
Raw Permalink Normal View History

#!flask/bin/python
from flask import Flask, request, render_template
import os
import subprocess
2019-03-23 00:02:51 +00:00
import re
app = Flask(__name__)
@app.route('/')
def my_form():
return render_template('my-form.html')
@app.route('/', methods=['POST'])
def form_post():
text = request.form['secret']
2019-03-23 00:02:51 +00:00
text = re.sub (r'([^a-zA-Z]+?)', '', text) # Remove all non-letters.
command = "python3 Caeser-Cipher/Caeser-Cipher.py encrypt " + str(text) + " 3"
ciphered_text = subprocess.check_output(command, shell=True)
return ciphered_text
if __name__ == '__main__':
2019-03-16 01:15:05 +00:00
app.run(host= '0.0.0.0')