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.
|
really sophisticated. However I'm not sure whether RMV supports that many HAFAS features publicly.
|
||||||
|
|
||||||
# To-Do
|
# To-Do
|
||||||
- [ ] arrivalBoard (boardArrival)
|
- [ ] arrivalBoard (board_arrival)
|
||||||
- [ ] departureBoard (boardArrival)
|
- [ ] departureBoard (board_departure)
|
||||||
- [x] himsearch (himSearch)
|
- [x] himsearch (him_search)
|
||||||
- [ ] journeyDetail
|
- [ ] journeyDetail (journey_detail)
|
||||||
- [x] location.nearbystops (stopByCoords)
|
- [x] location.nearbystops (stop_by_coords)
|
||||||
- [x] location.name (stopByName)
|
- [x] location.name (stop_by_name)
|
||||||
- [ ] recon
|
- [x] trip (trip_find)
|
||||||
- [x] trip (findRoute)
|
- [ ] recon (trip_recon)
|
@ -1,7 +1,8 @@
|
|||||||
from .boardArrival import boardArrival
|
from .board_arrival import board_arrival
|
||||||
from .boardDeparture import boardDeparture
|
from .board_departure import board_departure
|
||||||
from .findRoute import findRoute
|
from .him_search import him_search
|
||||||
from .himSearch import himSearch
|
from .journey_detail import journey_detail
|
||||||
from .journeyDetail import journeyDetail
|
from .stop_by_coords import stop_by_coords
|
||||||
from .stopByCoords import stopByCoords
|
from .stop_by_name import stop_by_name
|
||||||
from .stopByName import stopByName
|
from .trip_find import trip_find
|
||||||
|
from .trip_recon import trip_recon
|
@ -8,7 +8,7 @@ except ImportError:
|
|||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
# 2.25. Arrival Board (arrivalBoard)
|
# 2.25. Arrival Board (arrivalBoard)
|
||||||
def boardArrival(accessId: str,
|
def board_arrival(accessId: str,
|
||||||
json: bool = True
|
json: bool = True
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
|
@ -8,7 +8,7 @@ except ImportError:
|
|||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
# 2.24. Departure Board (departureBoard)
|
# 2.24. Departure Board (departureBoard)
|
||||||
def boardDeparture(accessId: str,
|
def board_departure(accessId: str,
|
||||||
json: bool = True
|
json: bool = True
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
|
@ -9,7 +9,7 @@ except ImportError:
|
|||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
# 2.37. HIM Search (himsearch)
|
# 2.37. HIM Search (himsearch)
|
||||||
def himSearch(accessId: str,
|
def him_search(accessId: str,
|
||||||
json: bool = True,
|
json: bool = True,
|
||||||
dateB: Union[str, datetime] = None,
|
dateB: Union[str, datetime] = None,
|
||||||
dateE: Union[str, datetime] = None,
|
dateE: Union[str, datetime] = None,
|
@ -8,7 +8,7 @@ except ImportError:
|
|||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
# 2.26. Journey Detail (journeyDetail)
|
# 2.26. Journey Detail (journeyDetail)
|
||||||
def journeyDetail(accessId: str,
|
def journey_detail(accessId: str,
|
||||||
json: bool = True
|
json: bool = True
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
|
@ -8,7 +8,7 @@ except ImportError:
|
|||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
# 2.4. Location Search by Coordinate (location.nearbystops)
|
# 2.4. Location Search by Coordinate (location.nearbystops)
|
||||||
def stopByCoords(accessId: str,
|
def stop_by_coords(accessId: str,
|
||||||
originCoordLat: Union[str, float],
|
originCoordLat: Union[str, float],
|
||||||
originCoordLong: Union[str, float],
|
originCoordLong: Union[str, float],
|
||||||
lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en",
|
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
|
from typing_extensions import Literal
|
||||||
|
|
||||||
# 2.3. Location Search by Name (location.name)
|
# 2.3. Location Search by Name (location.name)
|
||||||
def stopByName(accessId: str,
|
def stop_by_name(accessId: str,
|
||||||
inputString: str,
|
inputString: str,
|
||||||
lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en",
|
lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en",
|
||||||
json: bool = True,
|
json: bool = True,
|
@ -8,7 +8,7 @@ except ImportError:
|
|||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
# 2.12. Trip Search (trip)
|
# 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",
|
lang: Literal["de", "da", "en", "es", "fr", "hu", "it", "nl", "no", "pl", "sv", "tr"] = "en",
|
||||||
json: bool = True,
|
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