first departure monitor test
						commit
						15f73b3772
					
				| @ -0,0 +1,40 @@ | |||||||
|  | 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" | ||||||
|  | getStr = baseUrl+"XML_DM_REQUEST?"+ \ | ||||||
|  |         "outputFormat=JSON"+ \ | ||||||
|  |         "&stateless=1"+ \ | ||||||
|  |         "&locationServerActive=1" \ | ||||||
|  |         "&type_dm=stop"+ \ | ||||||
|  |         "&name_dm="+busstop+ \ | ||||||
|  |         "&useRealtime=1"+ \ | ||||||
|  |         "&mode=direct" \ | ||||||
|  |         "&ptOptionsActive=1" | ||||||
|  | response = requests.get(getStr) | ||||||
|  | 
 | ||||||
|  | for item in response.json()['departureList']: | ||||||
|  |     print(item['servingLine']['number'], end="\t") | ||||||
|  |     print(item['servingLine']['direction'], end="\t") | ||||||
|  |     hour=item['dateTime']['hour'] | ||||||
|  |     minute=item['dateTime']['minute'] | ||||||
|  |     if len(hour) < 2: | ||||||
|  |         hour="0"+hour | ||||||
|  |     if len(minute) < 2: | ||||||
|  |         minute="0"+minute | ||||||
|  |     print(hour+":"+minute) | ||||||
|  | 
 | ||||||
|  | #print(json.dumps(response.json()['departureList'], indent = 1))  | ||||||
|  | 
 | ||||||
					Loading…
					
					
				
		Reference in New Issue