def reply_to_sms_message(request): text = request.REQUEST['Body'] mtd = CumtdApi(os.environ['CUMTD_API_KEY']) stops = mtd.get_stops_by_search(text) buses = mtd.get_departures_by_stop(stops['stops'][0]['stop_id']) r = Response() response_text = 'Departures at ' + stops['stops'][0]['stop_name'] + '\n' for trip in buses['departures']: response_text += trip['headsign'] + ' in ' + str(trip['expected_mins']) + ' mins\n' r.sms(response_text[:159]) return r
print mtd.get_shape('5E') print "Testing GetShapeBetweenStops" print mtd.get_shape_between_stops('GRNNEIL:6', 'IU:1', '5E') print "Testing GetStop" print mtd.get_stop(['GRNNEIL', 'IU']) print "Testing GetStops" print mtd.get_stops() print "Testing GetStopsByLatLon" print mtd.get_stops_by_lat_lon('40.110999', '-88.245728') print "Testing GetStopsBySearch" print mtd.get_stops_by_search('state and william') print "Testing GetStopTimesByTrip" print mtd.get_stop_times_by_trip('1GN513__GN1') print "Testing GetStopTimesByStop" print mtd.get_stop_times_by_stop('GRNNEIL') print "Testing GetPlannedTripsByLatLon" print mtd.get_planned_trips_by_lat_lon('40.110999', '-88.245728', '40.107783', '-88.23163') print "Testing GetPlannedTripsByStops" print mtd.get_planned_trips_by_stops('GRNNEIL', 'IU') print "Testing GetTrip" print mtd.get_trip('1GN513__GN1')