-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
53 lines (43 loc) · 1.66 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
45
46
47
48
49
50
51
52
53
from flask import Flask, render_template, request
import Parser.main
import json
print("Setting 'recieved_data' to placeholder stats")
recived_data = [0, 1, 2, 3, 4, 5, 6]
print("recived_data now is ", recived_data)
q = {
"a": 0
}
#with open("flag.json", "w") as write_file:
# json.dump(q, write_file)
app = Flask(__name__)
@app.route('/', methods=['POST', 'GET'])
def index():
global recived_data
print("Entered 'Index' function with 'recived_data' on ", *send_data())
if request.method == 'POST':
city_from = request.form['city1']
city_to = request.form['city2']
length = request.form['length']
width = request.form['width']
high = request.form['high']
weight = request.form['weight']
cost = request.form['cost']
recived_data = [city_from, city_to, length, width, high, weight, cost]
print("Updated 'recived_data' to: ", *send_data(), " and importing 'Parser.main' file")
print("Just imported 'Parser.main file with 'recived_data' on: ", *send_data())
parsed_data = Parser.main.parse(send_data())
print("just get this data: ", *parsed_data)
try:
return render_template('index.html', data=parsed_data)
except:
return "Error: please input all data"
else:
data = "Nothing was ever parced"
return render_template('index.html', data=data)
def send_data():
global recived_data
print("Entered 'send_data' function with 'recived_data' ", recived_data)
return recived_data
print("Line 40 processing, right now in 'recieved_data': ", send_data())
if __name__ == '__main__':
app.run(host='0.0.0.0')