def predictions(request): route_and_stops = request.GET.getlist('stops') stops_json = [{'route': route_and_stop.split('|')[0], 'tag': route_and_stop.split('|')[1] } for route_and_stop in route_and_stops] return HttpResponse(Predictions.get(agency='sf-muni', stops=stops_json))
def setUp(self): self.predictions = Predictions.get(agency='sf-muni', stops=[{'route': 'N', 'tag': 5240}, {'route': 'K', 'tag': 7217}]) self.predictions._fetch_raw_xml = self.mockPredictionsXml self.predictions.fetch()