-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
61 lines (56 loc) · 1.53 KB
/
main.py
File metadata and controls
61 lines (56 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from flask import Flask, request
from caesar import rotate_string
app = Flask(__name__)
app.config['DEBUG'] = True
form = """
<!DOCTYPE html>
<html>
<head>
<style>
form {{
background-color: #00FF00;
padding: 20px;
margin: 0 auto;
width: 900px;
font: 2em sans-serif;
border-radius: 10px;
}}
label{{
color: #006400;
}}
input{{
font-size: 1.25em;
color: #228B22;
}}
textarea {{
margin: 10px 0;
width: 900px;
height: 240px;
font: 1.5em sans-serif;
color: #228B22;
}}
p.error {{
color: red;
}}
</style>
</head>
<body>
<!-- the form goes here -->
<form method="POST">
<p><label>Rotate by: <input id="rotations" type="text" name="rot" value="0" /></label></p>
<textarea id="textarea" type="textarea" name="text" />{0}</textarea>
<!-- <button type="submit" value="Submit Query"></button> -->
<input type="submit" value="Time to Rotate" />
</form>
</body>
</html>
"""
@app.route("/", methods=['POST'])
def encrypt():
rot = int(request.form['rot'])
text = request.form['text']
return form.format(rotate_string(text, rot))
@app.route("/")
def index():
return form.format("")
app.run()