Quite a lot of stuff completely renamed
This commit is contained in:
parent
872fd9a088
commit
d949778ac5
16
README.md
16
README.md
@ -47,11 +47,11 @@ RMV API key. Just use my functions together with those docs, if you want to buil
|
||||
really sophisticated. However I'm not sure whether RMV supports that many HAFAS features publicly.
|
||||
|
||||
# To-Do
|
||||
- [ ] arrivalBoard (boardArrival)
|
||||
- [ ] departureBoard (boardArrival)
|
||||
- [x] himsearch (himSearch)
|
||||
- [ ] journeyDetail
|
||||
- [x] location.nearbystops (stopByCoords)
|
||||
- [x] location.name (stopByName)
|
||||
- [ ] recon
|
||||
- [x] trip (findRoute)
|
||||
- [ ] arrivalBoard (board_arrival)
|
||||
- [ ] departureBoard (board_departure)
|
||||
- [x] himsearch (him_search)
|
||||
- [ ] journeyDetail (journey_detail)
|
||||
- [x] location.nearbystops (stop_by_coords)
|
||||
- [x] location.name (stop_by_name)
|
||||
- [x] trip (trip_find)
|
||||
- [ ] recon (trip_recon)
|
@ -1,7 +1,8 @@
|
||||
from .boardArrival import boardArrival
|
||||
from .boardDeparture import boardDeparture
|
||||
from .findRoute import findRoute
|
||||
from .himSearch import himSearch
|
||||
from .journeyDetail import journeyDetail
|
||||
from .stopByCoords import stopByCoords
|
||||
from .stopByName import stopByName
|
||||
from .board_arrival import board_arrival
|
||||
from .board_departure import board_departure
|
||||
from .him_search import him_search
|
||||
from .journey_detail import journey_detail
|
||||
from .stop_by_coords import stop_by_coords
|
||||
from .stop_by_name import stop_by_name
|
||||
from .trip_find import trip_find
|
||||
from .trip_recon import trip_recon
|
@ -8,7 +8,7 @@ except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.25. Arrival Board (arrivalBoard)
|
||||
def boardArrival(accessId: str,
|
||||
def board_arrival(accessId: str,
|
||||
json: bool = True
|
||||
) -> dict:
|
||||
|
@ -8,7 +8,7 @@ except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.24. Departure Board (departureBoard)
|
||||
def boardDeparture(accessId: str,
|
||||
def board_departure(accessId: str,
|
||||
json: bool = True
|
||||
) -> dict:
|
||||
|
@ -9,7 +9,7 @@ except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.37. HIM Search (himsearch)
|
||||
def himSearch(accessId: str,
|
||||
def him_search(accessId: str,
|
||||
json: bool = True,
|
||||
dateB: Union[str, datetime] = None,
|
||||
dateE: Union[str, datetime] = None,
|
@ -8,7 +8,7 @@ except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.26. Journey Detail (journeyDetail)
|
||||
def journeyDetail(accessId: str,
|
||||
def journey_detail(accessId: str,
|
||||
json: bool = True
|
||||
) -> dict:
|
||||
|
@ -8,7 +8,7 @@ except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.4. Location Search by Coordinate (location.nearbystops)
|
||||
def stopByCoords(accessId: str,
|
||||
def stop_by_coords(accessId: str,
|
||||
originCoordLat: Union[str, float],
|
||||
originCoordLong: Union[str, float],
|
||||
lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en",
|
@ -8,7 +8,7 @@ except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.3. Location Search by Name (location.name)
|
||||
def stopByName(accessId: str,
|
||||
def stop_by_name(accessId: str,
|
||||
inputString: str,
|
||||
lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en",
|
||||
json: bool = True,
|
@ -8,7 +8,7 @@ except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.12. Trip Search (trip)
|
||||
def findRoute(accessId: str,
|
||||
def trip_find(accessId: str,
|
||||
lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en",
|
||||
json: bool = True,
|
||||
|
32
pyrmv/raw/trip_recon.py
Normal file
32
pyrmv/raw/trip_recon.py
Normal file
@ -0,0 +1,32 @@
|
||||
from requests import get
|
||||
from typing import List, Union
|
||||
from xmltodict import parse as xmlparse
|
||||
|
||||
try:
|
||||
from typing import Literal
|
||||
except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
# 2.17. Reconstruction (recon)
|
||||
def trip_recon(accessId: str,
|
||||
json: bool = True
|
||||
) -> dict:
|
||||
|
||||
if json:
|
||||
headers = {"Accept": "application/json"}
|
||||
else:
|
||||
headers = {"Accept": "application/xml"}
|
||||
|
||||
payload = {}
|
||||
|
||||
for var, val in locals().items():
|
||||
if str(var) not in ["json", "headers", "payload"]:
|
||||
if val != None:
|
||||
payload[str(var)] = val
|
||||
|
||||
output = get("https://www.rmv.de/hapi/recon", params=payload, headers=headers)
|
||||
|
||||
if json:
|
||||
return output.json()
|
||||
else:
|
||||
return xmlparse(output.content)
|
Loading…
Reference in New Issue
Block a user