def update_routes(agencies=None): """ Refresh our list of Routes, Stops, and Directions from Nextbus """ if not agencies: agencies = app.config['AGENCIES'] route_count = 0 for agency_tag in agencies: route_count += len(Nextbus.get_routes(agency_tag, truncate=True)) print("update_routes: Got {0} routes for {1} agencies"\ .format(route_count, len(agencies)))
def data_init(agencies_only=False): from nextbus import Nextbus start = time.time() agencies = Nextbus.get_agencies() print("Got {0} agencies from Nextbus in {1:.2f} seconds.".format(len(agencies), time.time() - start)) if not agencies_only: for a in agencies: a_start = time.time() if a.tag in app.config['AGENCIES']: routes = Nextbus.get_routes(a.tag) print("Got {0} routes for agency \"{1}\" in {2:.2f} seconds.".format(len(routes), a.tag, time.time() - a_start)) print("Total time: {0:.2f} seconds".format(time.time() - start))
def data_init(agencies_only=False): from nextbus import Nextbus start = time.time() agencies = Nextbus.get_agencies() print("Got {0} agencies from Nextbus in {1:.2f} seconds.".format( len(agencies), time.time() - start)) if not agencies_only: for a in agencies: a_start = time.time() if a.tag in app.config['AGENCIES']: routes = Nextbus.get_routes(a.tag) print("Got {0} routes for agency \"{1}\" in {2:.2f} seconds.". format(len(routes), a.tag, time.time() - a_start)) print("Total time: {0:.2f} seconds".format(time.time() - start))