def update(self, entity): self.status = entity.vehicle.current_status self.timestampe = entity.vehicle.timestamp s = station.get_station(entity.vehicle.stop_id[:-1]) if s not in self.stations: self.stations.append(s)
def __init__(self, entity): self.id = entity.vehicle.trip.trip_id self.line = entity.vehicle.trip.route_id self.shapeid = entity.vehicle.trip.trip_id.split('_')[1] self.status = entity.vehicle.current_status self.timestampe = entity.vehicle.timestamp self.stations = [station.get_station(entity.vehicle.stop_id[:-1])]
def get_trains_from_stations(): trains = {} for station_id, station_name in ipa_config.stations: arrivals = [] try: arrivals, _ = station.get_station(station_id) print timestamp(), 'Visitied station', station_name.encode('utf-8') except: print timestamp(), 'Cannot get trains from station', station_name.encode('utf-8') for train in arrivals: trains[train['id']] = train return trains
from flask import render_template, flash from flask import request, redirect, url_for from flask_security import login_required from flask_login import logout_user from extension import (render_with_opt, get_category, app, SearchForm) from path_finder import playFinder from station import get_station from dbconfig import * from pymongo import MongoClient as mc bikeCol = get_station() client = mc('mongodb://150.95.204.252:27017') db = client.get_database('map_db') collection = db.get_collection('place') @app.route('/', methods=['GET', 'POST']) def main(): return redirect("/index/") @app.route('/index/', methods=['GET', 'POST']) def index(): locsearch = SearchForm() if request.method == "POST": try: src = request.form["src"] dest = request.form["dest"] print(src, dest) bike = playFinder(src.replace('대한민국 ', ''),