forked from mluong888/Whatcha-wanna-do
-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.py
51 lines (45 loc) · 1.66 KB
/
web.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
from flask import Flask, request, render_template
# from app import eb_api_query
from app2 import tm_api
import json
app = Flask(__name__)
@app.route('/')
def hello():
return render_template('index.html')
@app.route('/form-example', methods=['GET', 'POST']) #allow both GET and POST requests
def form_example():
if request.method == 'POST': #this block is only entered when the form is submitted
location = request.form.get('location')
date = request.form.get('date')
radius = request.form.get('radius')
# price = request.form.get('price')
category = request.form.get('category')
# acronym = func(category)
# temp = [{
# "name": "Marvin's Room",
# "url": "www.google.com",
# "description": "Wine and cheese night?",
# "location": "Marvin's room",
# "date": "2019-10-26T00:00:00",
# "start_time": "19:00",
# "end_time": "21:00",
# "image": "https://static.spin.com/files/120319-drake-640x426.png"
# },
# {
# "name": "Halloween Social",
# "url": "www.google.com",
# "description": "Celebrate halloween with Codeology!",
# "location": "Campanille",
# "date": "2019-10-31T00:00:00",
# "start_time": "19:00",
# "end_time": "24:00",
# "image": "https://i.ticketweb.com/i/00/09/30/87/89_Edp.jpg?v=3"
# },
# ]
temp = tm_api(location, date, radius, category)
# print(temp)
# print("=============================")
return render_template('index.html', lst = temp)
return render_template('index.html')
if __name__ == '__main__':
app.run()