fix datasource for tripinfo
This commit is contained in:
parent
5284f9a781
commit
9b97384b69
|
|
@ -30,8 +30,8 @@ def get_speed_db():
|
||||||
|
|
||||||
def get_trip_db():
|
def get_trip_db():
|
||||||
rs = "https://iceportal.de/api1/rs/tripInfo/trip/"
|
rs = "https://iceportal.de/api1/rs/tripInfo/trip/"
|
||||||
database = "trip.json"
|
response = get(rs)
|
||||||
data = json.loads(open(database).read())
|
data = response.json()
|
||||||
next_stop=data["trip"]["stopInfo"]["actualNext"]
|
next_stop=data["trip"]["stopInfo"]["actualNext"]
|
||||||
|
|
||||||
for i in data['trip']['stops']:
|
for i in data['trip']['stops']:
|
||||||
|
|
@ -41,7 +41,7 @@ def get_trip_db():
|
||||||
utime=i['timetable']['actualArrivalTime']/1000
|
utime=i['timetable']['actualArrivalTime']/1000
|
||||||
arrivalTime = datetime.fromtimestamp(utime, tz=timezonedt).strftime('%H:%M')
|
arrivalTime = datetime.fromtimestamp(utime, tz=timezonedt).strftime('%H:%M')
|
||||||
break
|
break
|
||||||
tripinfo = nextStationName + arrivalTime + arrivalDelay
|
tripinfo = nextStationName+" "+ arrivalTime+" " + arrivalDelay
|
||||||
return tripinfo
|
return tripinfo
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue