Basic Station Search
This commit is contained in:
parent
ea6b426c3c
commit
5068c7a302
3 changed files with 77 additions and 0 deletions
27
main.py
27
main.py
|
|
@ -9,5 +9,32 @@ The application will provide routing information and station departures/arrivals
|
|||
|
||||
import requests
|
||||
import json
|
||||
from datetime import datetime
|
||||
from prompt_toolkit import Application
|
||||
from prompt_toolkit.completion import WordCompleter
|
||||
|
||||
def stationRequest(station):
|
||||
res = session.post("https://fahrplan.ivb.at/bin/mgate.exe",
|
||||
data=json.dumps({"svcReqL": [{"req": {"input": {"field": "S", "loc": {"name": station, "type": "S"}}}, "meth": "LocMatch"}], "client": {"id": "VAO", "name": "webapp", "type": "WEB"}, "ver": "1.32", "lang": "de", "auth": {"type": "AID", "aid": "wf7mcf9bv3nv8g5f"}}),
|
||||
headers={'User-Agent': "IOS",'Content-Type': 'application/json'})
|
||||
return json.loads(res.text)
|
||||
|
||||
def departuresRequest(station):
|
||||
time = datetime.now()
|
||||
res = session.post("https://fahrplan.ivb.at/bin/mgate.exe",
|
||||
data=json.dumps({"svcReqL": [{"req": {"type": "DEP", "stbLoc": {"lid": f"A=1@L={station}@"}, "dirLoc": None, "maxJny": 1, "date": time.strftime("%Y%M%D"), "time": time.strftime("%H%M%S"), "dur": -1, "jnyFltrL": [{"type": "PROD", "mode": "INC", "value": "4087"}]}, "meth": "StationBoard"}], "client": {"id": "VAO", "name": "webapp", "type": "WEB"}, "ver": "1.32", "lang": "de", "auth": {"type": "AID", "aid": "wf7mcf9bv3nv8g5f"}}),
|
||||
headers={'User-Agent': "IOS",'Content-Type': 'application/json'})
|
||||
return json.loads(res.text)
|
||||
|
||||
def tripRequest(departure):
|
||||
res = session.post("https://fahrplan.ivb.at/bin/mgate.exe",
|
||||
data = json.dumps({"svcReqL": [{"req": {"jid": departure}, "meth": "JourneyDetails"}], "client": {"id": "VAO", "name": "webapp", "type": "WEB"}, "ver": "1.32", "lang": "de", "auth": {"type": "AID", "aid": "wf7mcf9bv3nv8g5f"}}),
|
||||
headers={'User-Agent': "IOS",'Content-Type': 'application/json'})
|
||||
return json.loads(res.text)
|
||||
|
||||
if __name__ == '__main__':
|
||||
session = requests.session()
|
||||
station = input("Enter Station Name: ")
|
||||
streq = stationRequest(station)
|
||||
bestFoundStation = streq["svcResL"][0]["res"]["match"]["locL"][0]
|
||||
print(bestFoundStation)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue