forked from codeforamerica/sheltraustin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchHandler.py
40 lines (34 loc) · 1.03 KB
/
SearchHandler.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
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import simplejson
from QueryHandler import QueryHandler
class SearchHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
if not self.request.arguments:
self.render('index.html')
return
address = self.request.arguments['address'][0]
bed = self.request.arguments['bed'][0]
food = self.request.arguments['food'][0]
medical = self.request.arguments['medical'][0]
mental_health = self.request.arguments['mental-health'][0]
substance_abuse = self.request.arguments['substance-abuse'][0]
transportation = self.request.arguments['transportation'][0]
distance = self.request.arguments['distance'][0]
data = {
'address': address,
'bed': bed,
'food': food,
'medical': medical,
'mental-health': mental_health,
'substance-abuse': substance_abuse,
'transportation': transportation,
'distance' : distance
}
output = QueryHandler.get_map(data)
self.write(output)
self.flush()
self.finish()