|
|
|
@ -10,12 +10,21 @@ getStr = baseUrl+"XML_DM_REQUEST?"+ \
|
|
|
|
"&locationServerActive=1" \
|
|
|
|
"&locationServerActive=1" \
|
|
|
|
"&type_dm=stop"+ \
|
|
|
|
"&type_dm=stop"+ \
|
|
|
|
"&name_dm=\""+busstop+"\"" \
|
|
|
|
"&name_dm=\""+busstop+"\"" \
|
|
|
|
"&useRealtime=1"+ \
|
|
|
|
|
|
|
|
"&mode=direct" \
|
|
|
|
"&mode=direct" \
|
|
|
|
"&ptOptionsActive=1"
|
|
|
|
"&ptOptionsActive=1" \
|
|
|
|
|
|
|
|
"&useRealtime=1"
|
|
|
|
response = requests.get(getStr)
|
|
|
|
response = requests.get(getStr)
|
|
|
|
response.encoding = 'UTF-8'
|
|
|
|
response.encoding = 'UTF-8'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#print(json.dumps(, indent=1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def prettyTime(hour, minute):
|
|
|
|
|
|
|
|
if len(hour) < 2:
|
|
|
|
|
|
|
|
hour="0"+hour
|
|
|
|
|
|
|
|
if len(minute) < 2:
|
|
|
|
|
|
|
|
minute="0"+minute
|
|
|
|
|
|
|
|
return hour+":"+minute
|
|
|
|
|
|
|
|
|
|
|
|
if "message" in response.json()['dm']:
|
|
|
|
if "message" in response.json()['dm']:
|
|
|
|
for item in response.json()['dm']['message']:
|
|
|
|
for item in response.json()['dm']['message']:
|
|
|
|
if item['name'] == "error" and item['value'] == "name list":
|
|
|
|
if item['name'] == "error" and item['value'] == "name list":
|
|
|
|
@ -25,14 +34,13 @@ if "message" in response.json()['dm']:
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|
|
|
|
print("selected: "+response.json()['dm']['points']['point']['name'])
|
|
|
|
for item in response.json()['departureList']:
|
|
|
|
for item in response.json()['departureList']:
|
|
|
|
hour=item['dateTime']['hour']
|
|
|
|
print(prettyTime(item['dateTime']['hour'], item['dateTime']['minute']), end="\t")
|
|
|
|
minute=item['dateTime']['minute']
|
|
|
|
if "realDateTime" in item:
|
|
|
|
if len(hour) < 2:
|
|
|
|
print(prettyTime(item['realDateTime']['hour'], item['realDateTime']['minute']), end="\t")
|
|
|
|
hour="0"+hour
|
|
|
|
else:
|
|
|
|
if len(minute) < 2:
|
|
|
|
print(" ",end='\t')
|
|
|
|
minute="0"+minute
|
|
|
|
|
|
|
|
print(hour+":"+minute, end="\t")
|
|
|
|
|
|
|
|
print(item['servingLine']['number'], end="\t")
|
|
|
|
print(item['servingLine']['number'], end="\t")
|
|
|
|
print(item['servingLine']['direction'])
|
|
|
|
print(item['servingLine']['direction'])
|
|
|
|
except TypeError:
|
|
|
|
except TypeError:
|
|
|
|
|