Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta Issue: modernize pyhafas, fix broken APIs #20

Open
4 tasks
leona-ya opened this issue Apr 1, 2023 · 3 comments
Open
4 tasks

Meta Issue: modernize pyhafas, fix broken APIs #20

leona-ya opened this issue Apr 1, 2023 · 3 comments
Assignees

Comments

@leona-ya
Copy link
Member

leona-ya commented Apr 1, 2023

After about 3 years of little work on pyhafas, it is unfortunately outdated. This is a tracker/meta issue to keep track of the broken APIs and other things requiring some work.

explicit to dos:

  • Tests
    • -> should be executed by GitHub Actions, probably also weekly to keep track of a broken API
    • Broken with modern pytest
  • Trip API - needs to be checked
@leona-ya leona-ya self-assigned this Apr 1, 2023
@1Maxnet1
Copy link
Contributor

I was able to fix the execution of pytest by upgrading to a more recent version (more specifically to pytest 6.2.5) as pointed out here: pytest-dev/pytest#9195 I try to fix the remaining broken failing tests and will create a PR then. My current work is available here: https://github.com/1Maxnet1/pyhafas/tree/fix-test-execution

@TheRealMurmel
Copy link

@leona-ya

  • Trip API - needs to be checked

What should be done here?

@TheRealMurmel
Copy link

My first attempt to test the status of the trip api indicates it is still working:

Code (example.py)

import datetime

from pyhafas import HafasClient
from pyhafas.profile import DBProfile

DB_STATION_ID_BONN = '8005556'

client = HafasClient(DBProfile(), debug=True)

# - Retrieve arrivals for Siegburg/Bonn
trips = client.arrivals(station=DB_STATION_ID_BONN, date=datetime.datetime.now(), max_trips=1)
trip = trips[0]
tripId = trip.id

# - Retrieve details for this trip
print(client.trip(tripId))

Output

$ python3 example.py 

<class 'pyhafas.types.fptf.Leg'>({'id': '1|1260724|27|80|24052023', 'origin': <class 'pyhafas.types.fptf.Station'>({'id': '443879', 'lid': 'A=1@O=Neunkirchen Antoniusplatz, Neunkirchen-Seelscheid@X=7333948@Y=50839573@U=80@L=443879@', 'name': 'Neunkirchen Antoniusplatz, Neunkirchen-Seelscheid', 'latitude': 50.839573, 'longitude': 7.333948}), 'destination': <class 'pyhafas.types.fptf.Station'>({'id': '443110', 'lid': 'A=1@O=Bahnhof, Siegburg@X=7203686@Y=50794204@U=80@L=443110@', 'name': 'Bahnhof, Siegburg', 'latitude': 50.794204, 'longitude': 7.203686}), 'departure': datetime.datetime(2023, 5, 24, 18, 34, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrival': datetime.datetime(2023, 5, 24, 19, 7, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'mode': <Mode.TRAIN>, 'name': 'Bus 577', 'cancelled': False, 'distance': None, 'departureDelay': None, 'departurePlatform': None, 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'stopovers': [<class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '443879', 'lid': 'A=1@O=Neunkirchen Antoniusplatz, Neunkirchen-Seelscheid@X=7333948@Y=50839573@U=80@L=443879@', 'name': 'Neunkirchen Antoniusplatz, Neunkirchen-Seelscheid', 'latitude': 50.839573, 'longitude': 7.333948}), 'cancelled': False, 'arrival': None, 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 34, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '440301', 'lid': 'A=1@O=Pohlhausen Herkenrath Abzw., Neunkirchen-Seelschei@X=7306630@Y=50846198@U=80@L=440301@', 'name': 'Pohlhausen Herkenrath Abzw., Neunkirchen-Seelschei', 'latitude': 50.846198, 'longitude': 7.30663}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 38, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 38, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '440265', 'lid': 'A=1@O=Pohlhausen, Neunkirchen-Seelscheid@X=7295501@Y=50847375@U=80@L=440265@', 'name': 'Pohlhausen, Neunkirchen-Seelscheid', 'latitude': 50.847375, 'longitude': 7.295501}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 40, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 40, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '445423', 'lid': 'A=1@O=Pohlhausen Winkel Abzw., Neunkirchen-Seelscheid@X=7288067@Y=50841209@U=80@L=445423@', 'name': 'Pohlhausen Winkel Abzw., Neunkirchen-Seelscheid', 'latitude': 50.841209, 'longitude': 7.288067}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 41, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 41, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '445433', 'lid': 'A=1@O=Hochhausen, Neunkirchen-Seelscheid@X=7285748@Y=50834619@U=80@L=445433@', 'name': 'Hochhausen, Neunkirchen-Seelscheid', 'latitude': 50.834619, 'longitude': 7.285748}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 42, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 42, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '444178', 'lid': 'A=1@O=Birk Marienhöhe, Lohmar@X=7280274@Y=50834161@U=80@L=444178@', 'name': 'Birk Marienhöhe, Lohmar', 'latitude': 50.834161, 'longitude': 7.280274}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 44, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 44, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '443536', 'lid': 'A=1@O=Birk Kirche, Lohmar@X=7275716@Y=50835285@U=80@L=443536@', 'name': 'Birk Kirche, Lohmar', 'latitude': 50.835285, 'longitude': 7.275716}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 45, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 45, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '441817', 'lid': 'A=1@O=Birk Zum Friedenskreuz, Lohmar@X=7270466@Y=50835222@U=80@L=441817@', 'name': 'Birk Zum Friedenskreuz, Lohmar', 'latitude': 50.835222, 'longitude': 7.270466}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 46, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 46, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '445145', 'lid': 'A=1@O=Birk Inger, Lohmar@X=7268624@Y=50834422@U=80@L=445145@', 'name': 'Birk Inger, Lohmar', 'latitude': 50.834422, 'longitude': 7.268624}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 47, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 47, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': None, 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '440113', 'lid': 'A=1@O=Heide Albach, Lohmar@X=7266277@Y=50828947@U=80@L=440113@', 'name': 'Heide Albach, Lohmar', 'latitude': 50.828947, 'longitude': 7.266277}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 48, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': None, 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 48, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '440123', 'lid': 'A=1@O=Heide Kapellenstr., Lohmar@X=7265190@Y=50825810@U=80@L=440123@', 'name': 'Heide Kapellenstr., Lohmar', 'latitude': 50.82581, 'longitude': 7.26519}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 49, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 49, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '444415', 'lid': 'A=1@O=Heide Franzhäuschen, Siegburg@X=7263455@Y=50820452@U=80@L=444415@', 'name': 'Heide Franzhäuschen, Siegburg', 'latitude': 50.820452, 'longitude': 7.263455}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 50, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 50, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '444418', 'lid': 'A=1@O=Stallberg Kirche, Siegburg@X=7231022@Y=50807499@U=80@L=444418@', 'name': 'Stallberg Kirche, Siegburg', 'latitude': 50.807499, 'longitude': 7.231022}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 55, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 55, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '444432', 'lid': 'A=1@O=Schwimmbad, Siegburg@X=7220109@Y=50803418@U=80@L=444432@', 'name': 'Schwimmbad, Siegburg', 'latitude': 50.803418, 'longitude': 7.220109}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 57, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 57, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '444431', 'lid': 'A=1@O=Holzgasse, Siegburg@X=7211111@Y=50799499@U=80@L=444431@', 'name': 'Holzgasse, Siegburg', 'latitude': 50.799499, 'longitude': 7.211111}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 18, 59, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 18, 59, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '445738', 'lid': 'A=1@O=Cecilienstr., Siegburg@X=7208387@Y=50799606@U=80@L=445738@', 'name': 'Cecilienstr., Siegburg', 'latitude': 50.799606, 'longitude': 7.208387}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 19, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 19, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '441885', 'lid': 'A=1@O=Volkshochschule, Siegburg@X=7206077@Y=50801287@U=80@L=441885@', 'name': 'Volkshochschule, Siegburg', 'latitude': 50.801287, 'longitude': 7.206077}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 19, 1, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 19, 1, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '447196', 'lid': 'A=1@O=Zum Hohen Ufer, Siegburg@X=7202445@Y=50800532@U=80@L=447196@', 'name': 'Zum Hohen Ufer, Siegburg', 'latitude': 50.800532, 'longitude': 7.202445}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 19, 3, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 19, 3, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '440486', 'lid': 'A=1@O=Rhein-Sieg-Forum, Siegburg@X=7202742@Y=50796892@U=80@L=440486@', 'name': 'Rhein-Sieg-Forum, Siegburg', 'latitude': 50.796892, 'longitude': 7.202742}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 19, 4, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': datetime.datetime(2023, 5, 24, 19, 4, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'departureDelay': datetime.timedelta(seconds=3780), 'departurePlatform': None}), <class 'pyhafas.types.fptf.Stopover'>({'stop': <class 'pyhafas.types.fptf.Station'>({'id': '443110', 'lid': 'A=1@O=Bahnhof, Siegburg@X=7203686@Y=50794204@U=80@L=443110@', 'name': 'Bahnhof, Siegburg', 'latitude': 50.794204, 'longitude': 7.203686}), 'cancelled': False, 'arrival': datetime.datetime(2023, 5, 24, 19, 7, tzinfo=<DstTzInfo 'Europe/Berlin' CEST+2:00:00 DST>), 'arrivalDelay': datetime.timedelta(seconds=3780), 'arrivalPlatform': None, 'departure': None, 'departureDelay': None, 'departurePlatform': None})]})

Process finished with exit code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants