def update_vehicle_locations(agencies=None): """ Get the latest vehicle locations (coords/speed/heading) from NextBus """ start = time.time() if not agencies: agencies = app.config['AGENCIES'] vl_count = len(Nextbus.get_vehicle_locations(agencies, truncate=False)) elapsed = time.time() - start print("Got {0} vehicle locations for {1} agencies in {2:0.2f} seconds."\ .format(vl_count, len(agencies), elapsed))
def do_it(agencies): from nextbus import Nextbus from models import Agency start = time.time() if agencies: agencies = agencies.split(",") if not agencies: agencies = app.config['AGENCIES'] vl_count = len(Nextbus.get_vehicle_locations(agencies, truncate=False)) elapsed = time.time() - start print("Got {0} vehicle locations for {1} agencies in {2:0.2f} seconds."\ .format(vl_count, len(agencies), elapsed))