|
|
|
|
@ -1,31 +1,30 @@
|
|
|
|
|
import json
|
|
|
|
|
import requests
|
|
|
|
|
|
|
|
|
|
#busstop = "\"streetID:1500001109::3101000:-1:B%C3%BCltenweg:Braunschweig:B%C3%BCltenweg::B%C3%BCltenweg:%2038106:ANY:DIVA_STREET:1172970:5148740:MRCV:NDS\""
|
|
|
|
|
|
|
|
|
|
#response = requests.get(baseUrl + "XML_DM_REQUEST?sessionID=0&outputFormat=JSON&locationServerActive=1&type_dm=any&name_dm=" + busstop)
|
|
|
|
|
#if response.ok:
|
|
|
|
|
#for item in response.json()['parameters']:
|
|
|
|
|
# if item['name'] == "sessionID":
|
|
|
|
|
# sessionID = item['value']
|
|
|
|
|
#print("session id:" + sessionID)
|
|
|
|
|
|
|
|
|
|
#getStr = baseUrl+"XML_DM_REQUEST?sessionID="+sessionID+"&requestID=1"+"&outputFormat=JSON"+"&dmLineSelectionAll=1"
|
|
|
|
|
|
|
|
|
|
baseUrl = "https://bsvg.efa.de/bsvagstd/"
|
|
|
|
|
busstop = "26000084"
|
|
|
|
|
busstop = input("enter busstop name: ")
|
|
|
|
|
|
|
|
|
|
getStr = baseUrl+"XML_DM_REQUEST?"+ \
|
|
|
|
|
"outputFormat=JSON"+ \
|
|
|
|
|
"&stateless=1"+ \
|
|
|
|
|
"&locationServerActive=1" \
|
|
|
|
|
"&type_dm=stop"+ \
|
|
|
|
|
"&name_dm="+busstop+ \
|
|
|
|
|
"&name_dm=\""+busstop+"\"" \
|
|
|
|
|
"&useRealtime=1"+ \
|
|
|
|
|
"&mode=direct" \
|
|
|
|
|
"&ptOptionsActive=1"
|
|
|
|
|
response = requests.get(getStr)
|
|
|
|
|
response.encoding = 'UTF-8'
|
|
|
|
|
|
|
|
|
|
if "message" in response.json()['dm']:
|
|
|
|
|
for item in response.json()['dm']['message']:
|
|
|
|
|
if item['name'] == "error" and item['value'] == "name list":
|
|
|
|
|
print("select one of:")
|
|
|
|
|
for point in response.json()['dm']['points']:
|
|
|
|
|
print(point['name'])
|
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
for item in response.json()['departureList']:
|
|
|
|
|
hour=item['dateTime']['hour']
|
|
|
|
|
minute=item['dateTime']['minute']
|
|
|
|
|
@ -36,6 +35,5 @@ for item in response.json()['departureList']:
|
|
|
|
|
print(hour+":"+minute, end="\t")
|
|
|
|
|
print(item['servingLine']['number'], end="\t")
|
|
|
|
|
print(item['servingLine']['direction'])
|
|
|
|
|
|
|
|
|
|
#print(json.dumps(response.json()['departureList'], indent = 1))
|
|
|
|
|
|
|
|
|
|
except TypeError:
|
|
|
|
|
print("Couldn't get list")
|
|
|
|
|
|