Exemple #1
0
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
Exemple #2
0
    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))