-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
44 lines (35 loc) · 1.03 KB
/
app.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
from flask import Flask,render_template,request
from robots import bot_controller
import view.website_connection as wc
import persistence as p
app = Flask(__name__)
@app.route('/subscribe',methods=['GET','POST'])
def subscribe():
form_data = request.form
email = form_data['email']
selected_shoe = form_data['sn']
shoe_size = form_data['ss']
weekly_update = False
gender = 'Male'
try:
gender = form_data['sg']
if gender == 'on':
gender = 'Female'
except:
pass
try:
weekly_update = form_data['su']
if weekly_update == 'on':
weekly_update = 'Daily'
except:
pass
global details
details = {'email':email, 'shoes':selected_shoe, 'size':shoe_size, 'updates':weekly_update, 'gender':gender}
conn = wc.config_connect()
p.db_updates.push_to_shoe_request(conn, details)
return render_template('success.html')
@app.route('/')
def index():
return render_template('index.html')
#if __name__ == '__main__':
app.run()