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))
def update_agencies(): """ Refresh our list of Agencies from NextBus """ Nextbus.get_agencies(truncate=True)