Esempio n. 1
0
def search(request, input):
    results = {}
    results['routes'] = [ formats.route_to_dict(route) for route in queries.search_routes(input) ]
    if len(input) > 3:
        results['stops'] = [ formats.stop_to_dict(stop) for stop in queries.search_stops(input) ]
    return HttpResponse(formats.dict_to_json(results), mimetype='application/json')
Esempio n. 2
0
def get_trip_from_id(request, trip_id):
    trip = formats.trip_to_dict(queries.get_trip_from_id(trip_id))
    return HttpResponse(formats.dict_to_json(trip), mimetype='application/json')
Esempio n. 3
0
def get_num_stops_within_bounds(request, n, s, e, w):
    num_stops = queries.get_num_stops_within_bounds(n, s, e, w)
    return HttpResponse(formats.dict_to_json({'num_stops': num_stops}), mimetype='application/json')