def stop_times_to_dict(stop_times): trips = [] for stoptime in stop_times: trip = {} trip['time'] = format_time(gtfs.parse_stop_time(stoptime.departure_time)) trip['trip_id'] = stoptime.trip_id trips.append(trip) return trips
def trip_stops_to_dict(stop_times): stops = [] for stoptime in stop_times: stop = {} stop['stop_id'] = stoptime.stop.stop_id stop['stop_name'] = stoptime.stop.stop_name.title() stop['latitude'] = stoptime.stop.stop_lat stop['longitude'] = stoptime.stop.stop_lon stop['time'] = format_time(gtfs.parse_stop_time(stoptime.departure_time)) stops.append(stop) return stops