示例#1
0
文件: app.py 项目: czli/Junction2015
def search():
    data = request.get_json()
    #print(data)
    response = search_routes(data['homeCity'], data['cities'], data['startTime'], data['endTime'])
    # print(type(response))
    import pprint
    pprint.pprint(json.loads(response))
    return response
示例#2
0
文件: main.py 项目: jbochi/to-a-pe
    def get(self, bookmark=None):
        search_string = self.request.get('q')
        routes = search_routes(search_string, limit=PAGESIZE)

        for route in routes:
            if route.preview_image_url is None:
                route.set_preview_image_url()

        template_values = {
            'search': search_string.encode('utf-8'),
            'routes': routes,
        }

        path = os.path.join(os.path.dirname(__file__), 'templates/search_results.html')
        self.response.out.write(template.render(path, template_values))