-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
83 lines (70 loc) · 1.96 KB
/
main.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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: #eee;
padding: 20px;
margin: 0 auto;
width: 540px;
font: 16px sans-serif;
border-radius: 10px;
}}
textarea {{
margin: 10px 0;
width: 540px;
height: 120px;
}}
</style>
</head>
<body>
<form method="post">
<div>
<label for="rot">Rotate by:</label>
<input type="text" name="rot" value="0">
<p class="error"></p>
</div>
<textarea type="text" name="text">{0}</textarea>
<br>
<input type="submit">
</form>
</body>
</html>
"""
# def alphabet_position (letter):
# alphabet ="abcdefghijklmnopqrstuvwxyz" #Lists alphabet for a key
# lower_letter = letter.lower() #Makes any input lowercase.
# return alphabet.index(lower_letter)
""" def alphabet_position(letter):
alphabet ="abcdefghijklmnopqrstuvwxyz" #Lists alphabet for a key
lower_letter = letter.lower() #Makes any input lowercase.
for letter in alphabet:
return alphabet.index(lower_letter) #Returns the position of input as a number. """
""" def encrypt(text, rot):
for char in text:
print(char)
new_char = rotate_character(char, rot)
text += str(new_char)
return "" """
""" @app.route("/", methods=['POST'])
def get_text(text):
text=input("Type your text here.")
return text """
@app.route("/", methods=['POST'])
def submission():
rot = request.form['rot']
text = request.form['text']
return form.format(rotate_string(text, rot))
@app.route("/")
def index():
return form.format("")
""" @app.route("/hello", methods=['POST'])Con
def hello():
first_name = request.form['first_name']
return '<h1>Hello, ' + first_name +'</h1>' """
app.run()