4 Commits

Author SHA1 Message Date
a5022011ed Removed unused imports and fixed real_time_mode 2022-10-06 13:04:27 +02:00
23527c85f3 Removed unused imports 2022-10-06 13:04:17 +02:00
3f738f453b Integrated journey_detail 2022-10-06 13:04:00 +02:00
1a82665932 Added journey_detail to completed in To-Do 2022-10-06 13:03:44 +02:00
6 changed files with 12 additions and 13 deletions

View File

@@ -80,7 +80,7 @@ really sophisticated. However I'm not sure whether RMV supports that many HAFAS
- [x] arrivalBoard (board_arrival) - [x] arrivalBoard (board_arrival)
- [x] departureBoard (board_departure) - [x] departureBoard (board_departure)
- [ ] himsearch (him_search) - [ ] himsearch (him_search)
- [ ] journeyDetail (journey_detail) - [x] journeyDetail (journey_detail)
- [x] location.nearbystops (stop_by_coords) - [x] location.nearbystops (stop_by_coords)
- [x] location.name (stop_by_name) - [x] location.name (stop_by_name)
- [x] trip (trip_find) - [x] trip (trip_find)

View File

@@ -1,13 +1,12 @@
# from pyrmv.methods.journey_detail import journey_detail
from datetime import datetime from datetime import datetime
from pyrmv.methods.journey_detail import journey_detail
from pyrmv.methods.stop_by_id import stop_by_id from pyrmv.methods.stop_by_id import stop_by_id
class LineArrival(): class LineArrival():
def __init__(self, data, access_id: str): def __init__(self, data, access_id: str):
# self.journey = journey_detail(line["JourneyDetailRef"]["ref"]) self.journey = journey_detail(access_id, data["JourneyDetailRef"]["ref"])
self.status = data["JourneyStatus"] self.status = data["JourneyStatus"]
# self.messages = [] # self.messages = []
self.name = data["name"] self.name = data["name"]
@@ -30,7 +29,7 @@ class LineArrival():
class LineDeparture(): class LineDeparture():
def __init__(self, data, access_id: str): def __init__(self, data, access_id: str):
# self.journey = journey_detail(line["JourneyDetailRef"]["ref"]) self.journey = journey_detail(access_id, data["JourneyDetailRef"]["ref"])
self.status = data["JourneyStatus"] self.status = data["JourneyStatus"]
# self.messages = [] # self.messages = []
self.name = data["name"] self.name = data["name"]

View File

@@ -3,7 +3,6 @@ from typing import Union
from pyrmv.classes.Board import BoardArrival from pyrmv.classes.Board import BoardArrival
from pyrmv.classes.Stop import Stop, StopTrip from pyrmv.classes.Stop import Stop, StopTrip
from pyrmv.enums.board_type import BoardArrivalType from pyrmv.enums.board_type import BoardArrivalType
from pyrmv.errors.not_ready import NotReadyYetError
from pyrmv.raw import board_arrival as raw_board_arrival from pyrmv.raw import board_arrival as raw_board_arrival
from pyrmv.utility.find_exception import find_exception from pyrmv.utility.find_exception import find_exception
@@ -69,5 +68,4 @@ def board_arrival(
find_exception(board_raw) find_exception(board_raw)
# raise NotReadyYetError()
return BoardArrival(board_raw, access_id) return BoardArrival(board_raw, access_id)

View File

@@ -3,7 +3,6 @@ from typing import Union
from pyrmv.classes.Board import BoardDeparture from pyrmv.classes.Board import BoardDeparture
from pyrmv.classes.Stop import Stop, StopTrip from pyrmv.classes.Stop import Stop, StopTrip
from pyrmv.enums.board_type import BoardDepartureType from pyrmv.enums.board_type import BoardDepartureType
from pyrmv.errors.not_ready import NotReadyYetError
from pyrmv.raw import board_departure as raw_board_departure from pyrmv.raw import board_departure as raw_board_departure
from pyrmv.utility.find_exception import find_exception from pyrmv.utility.find_exception import find_exception
@@ -69,5 +68,4 @@ def board_departure(
find_exception(board_raw) find_exception(board_raw)
# raise NotReadyYetError()
return BoardDeparture(board_raw, access_id) return BoardDeparture(board_raw, access_id)

View File

@@ -1,7 +1,6 @@
from datetime import datetime from datetime import datetime
from typing import Union from typing import Union
from pyrmv.classes.Journey import Journey from pyrmv.classes.Journey import Journey
from pyrmv.errors.not_ready import NotReadyYetError
from pyrmv.enums.rt_mode import RealTimeMode from pyrmv.enums.rt_mode import RealTimeMode
from pyrmv.raw.journey_detail import journey_detail as raw_journey_detail from pyrmv.raw.journey_detail import journey_detail as raw_journey_detail
from pyrmv.utility.find_exception import find_exception from pyrmv.utility.find_exception import find_exception
@@ -23,7 +22,7 @@ def journey_detail(
to_index: int = None # type: ignore to_index: int = None # type: ignore
) -> Journey: ) -> Journey:
"""The journey_detail method will deliver information about the complete route of a vehicle. The journey """The journey_detail method will deliver information about the complete route of a vehicle. The journey
identifier is part of a trip or `board_departure` response. It contains a list of all stops/stations of this journey identifier is part of a trip or `board_departure()` response. It contains a list of all stops/stations of this journey
including all departure and arrival times (with real-time data if available) and additional information like including all departure and arrival times (with real-time data if available) and additional information like
specific attributes about facilities and other texts. specific attributes about facilities and other texts.
@@ -43,11 +42,16 @@ def journey_detail(
* Journey: Instance of Journey object. * Journey: Instance of Journey object.
""" """
if real_time_mode == None:
real_time_mode = None
else:
real_time_mode = real_time_mode.code
journey_raw = raw_journey_detail( journey_raw = raw_journey_detail(
accessId=access_id, accessId=access_id,
id=id, id=id,
date=date, date=date,
rtMode=real_time_mode.code, rtMode=real_time_mode,
fromId=from_id, fromId=from_id,
fromIdx=from_index, fromIdx=from_index,
toId=to_id, toId=to_id,

View File

@@ -5,7 +5,7 @@ setup(
version="0.2.9", version="0.2.9",
author="Profitroll", author="Profitroll",
description="Small module that makes your journey with RMV REST API somehow easier.", description="Small module that makes your journey with RMV REST API somehow easier.",
long_description="## PythonRMV\n\nSmall module that makes your journey with RMV REST API somehow easier. Based fully on official RMV API reference and HAFAS documentation.\n\n# Usage\n\n```py\nimport pyrmv\n\n# Set API key\naccess_id = \"Something\"\n\n# Get origin's and destination's location\norigin = pyrmv.stop_by_name(access_id, \"Frankfurt Hauptbahnhof\", max_number=3)[0]\ndestination = pyrmv.stop_by_coords(access_id, 50.099613, 8.685449, max_number=3)[0]\n\n# Find a trip by locations got\ntrip = pyrmv.trip_find(access_id, origin_id=origin.id, dest_id=destination.id)\n```\n\n# Frequently Asked Questions\n\n- [Why are there raw versions and formatted ones?](#why-are-there-raw-versions-and-formatted-ones)\n- [Some methods work slightly different](#some-methods-work-slightly-different)\n- [Documentation is not perfectly clear](#documentation-is-not-perfectly-clear)\n\n## Why are there raw versions and formatted ones?\n\nFor the purposes of my projects I don't really need all the stuff RMV gives (even though it's not much).\nI only need some specific things. However I do understand that in some cases other users may find\nthose methods quite useful so I implemented them as well.\n\n\n## Some methods work slightly different\n\nCan be. Not all function arguments written may work perfectly because I simply did not test each and\nevery request. Some of arguments may be irrelevant in my use-case and the others are used quite rare at all.\nJust [make an issue](https://git.end-play.xyz/profitroll/PythonRMV/issues/new) and I'll implement it correct when I'll have some free time.\n\n## Documentation is not perfectly clear\n\nOf course docs cannot be perfect as a python docstring, especially if sometimes I don't\nknow how things should correctly work. That's why you get HAFAS API docs in addition to your\nRMV API key. Just use my functions together with those docs, if you want to build something\nreally sophisticated. However I'm not sure whether RMV supports that many HAFAS features publicly.\n\n# To-Do\n## General\n- [ ] Docs in Wiki\n\n## Raw methods\n- [x] arrivalBoard (board_arrival) \n- [x] departureBoard (board_departure) \n- [x] himsearch (him_search) \n- [x] journeyDetail (journey_detail)\n- [x] location.nearbystops (stop_by_coords) \n- [x] location.name (stop_by_name) \n- [x] trip (trip_find) \n- [x] recon (trip_recon)\n\n## Normal methods\n- [x] arrivalBoard (board_arrival) \n- [x] departureBoard (board_departure) \n- [ ] himsearch (him_search) \n- [ ] journeyDetail (journey_detail)\n- [x] location.nearbystops (stop_by_coords) \n- [x] location.name (stop_by_name) \n- [x] trip (trip_find) \n- [ ] recon (trip_recon)", long_description="## PythonRMV\n\nSmall module that makes your journey with RMV REST API somehow easier. Based fully on official RMV API reference and HAFAS documentation.\n\n# Usage\n\n```py\nimport pyrmv\n\n# Set API key\naccess_id = \"Something\"\n\n# Get origin's and destination's location\norigin = pyrmv.stop_by_name(access_id, \"Frankfurt Hauptbahnhof\", max_number=3)[0]\ndestination = pyrmv.stop_by_coords(access_id, 50.099613, 8.685449, max_number=3)[0]\n\n# Find a trip by locations got\ntrip = pyrmv.trip_find(access_id, origin_id=origin.id, dest_id=destination.id)\n```\n\n# Frequently Asked Questions\n\n- [Why are there raw versions and formatted ones?](#why-are-there-raw-versions-and-formatted-ones)\n- [Some methods work slightly different](#some-methods-work-slightly-different)\n- [Documentation is not perfectly clear](#documentation-is-not-perfectly-clear)\n\n## Why are there raw versions and formatted ones?\n\nFor the purposes of my projects I don't really need all the stuff RMV gives (even though it's not much).\nI only need some specific things. However I do understand that in some cases other users may find\nthose methods quite useful so I implemented them as well.\n\n\n## Some methods work slightly different\n\nCan be. Not all function arguments written may work perfectly because I simply did not test each and\nevery request. Some of arguments may be irrelevant in my use-case and the others are used quite rare at all.\nJust [make an issue](https://git.end-play.xyz/profitroll/PythonRMV/issues/new) and I'll implement it correct when I'll have some free time.\n\n## Documentation is not perfectly clear\n\nOf course docs cannot be perfect as a python docstring, especially if sometimes I don't\nknow how things should correctly work. That's why you get HAFAS API docs in addition to your\nRMV API key. Just use my functions together with those docs, if you want to build something\nreally sophisticated. However I'm not sure whether RMV supports that many HAFAS features publicly.\n\n# To-Do\n## General\n- [ ] Docs in Wiki\n\n## Raw methods\n- [x] arrivalBoard (board_arrival) \n- [x] departureBoard (board_departure) \n- [x] himsearch (him_search) \n- [x] journeyDetail (journey_detail)\n- [x] location.nearbystops (stop_by_coords) \n- [x] location.name (stop_by_name) \n- [x] trip (trip_find) \n- [x] recon (trip_recon)\n\n## Normal methods\n- [x] arrivalBoard (board_arrival) \n- [x] departureBoard (board_departure) \n- [ ] himsearch (him_search) \n- [x] journeyDetail (journey_detail)\n- [x] location.nearbystops (stop_by_coords) \n- [x] location.name (stop_by_name) \n- [x] trip (trip_find) \n- [ ] recon (trip_recon)",
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
author_email="profitroll@end-play.xyz", author_email="profitroll@end-play.xyz",
url="https://git.end-play.xyz/profitroll/PythonRMV", url="https://git.end-play.xyz/profitroll/PythonRMV",