def station_next(code, lignesens): t = Timeo() times = t.get_arret(lignesens, code) line,direction = lignesens.split('_') return jsondump({ "type": "next_stops", "station": code, "line": line, "direction": direction, "stops": times })
def next_times(lignesens): t = Timeo() codes = t.getall_arrets(lignesens) times = {} for code in codes: times[code] = t.get_arret(lignesens, code) return jsondump({ "type": "multiple_next_stops", "stops": times })
def lines_stations(lignesens): # TODO: A améliorer t = Timeo() result = {} result['type'] = 'line_stations' result['stations'] = t.getall_arrets(lignesens) coords = meta.coords(list(result['stations'].keys())) if not set(result['stations'].keys()) == set(coords.keys()): for i in set(result['stations'].keys())-set(coords.keys()): coords[i] = [] for code in result['stations'].keys(): result['stations'][code] = { 'coords': coords[code], 'name': result['stations'][code] } return jsondump(result)
def lines_all(): t = Timeo() result = {} result['type'] = 'lines' result['lines'] = t.get_lignes() return jsondump(result)