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

DB ticket information not available after timetable change (Fahrplanwechsel) #331

Open
grssnbchr opened this issue Nov 30, 2024 · 8 comments

Comments

@grssnbchr
Copy link

grssnbchr commented Nov 30, 2024

While the hafas-client with DB profile is still able to find journeys after 2024-12-15, it always returns empty fare information after this date.

Running this example (function call with tickets=true) with a journey that departs before 2024-12-15 still also returns ticket information,

https://github.com/public-transport/hafas-client/blob/e9211e8105049b39c00c62fb33c55990ec3e45e7/p/db/example.js

after this date, there's no ticketing information.

Any clue why this might be the case? Is a new auth / salt / version needed?

@derhuerst
Copy link
Member

@traines-source
Copy link
Member

traines-source commented Dec 9, 2024

TL;DR: It is not yet known what the exact reason for this is, but the legacy DB HAFAS API simply doesn't seem to return the prices anymore. Furthermore, it has been increasingly unstable in the past couple of weeks (lots of CGI: server could not be reached and similar errors). Since the new bahn.de and DB Navigator now use a different API, this might all hint at the legacy HAFAS API being turned off soon, although people say that there are no concrete plans for that inside DB.
I have started building a drop-in-replacement for hafas-client that relies on the new APIs of bahn.de amongst others, https://github.com/public-transport/db-vendo-client, but it is still very alpha and it remains to be seen how well it will work with regards to quotas etc (but it returns prices!).

@derhuerst
Copy link
Member

derhuerst commented Dec 10, 2024

TL;DR: It is not yet known what the exact reason for this is, but the legacy DB HAFAS API simply doesn't seem to return the prices anymore.

It seems to be that refreshJourneys() still has a working prices & tickets. Can you confirm that?

If that is the case, then we could automatically query it in journeys() if opt.tickets is true.

Furthermore, it has been increasingly unstable in the past couple of weeks [...]. Since the new bahn.de and DB Navigator now use a different API, this might all hint at the legacy HAFAS API being turned off soon, although people say that there are no concrete plans for that inside DB. I have started building a drop-in-replacement for hafas-client that relies on the new APIs of bahn.de amongst others, https://github.com/public-transport/db-vendo-client [...].

That's great!

While it seems very worthwhile to investigate possible alternatives to DB's HAFAS mgate.exe API, I think for hafas-client the goal should be to work with whatever is left of the API as well as possible, just to keep the ecosystem building on it (and equivalent clients in other languages) working.

@derhuerst
Copy link
Member

cc @PaulSut

@grssnbchr
Copy link
Author

grssnbchr commented Dec 10, 2024

It seems to be that refreshJourneys() still has a working prices & tickets. Can you confirm that?

If that is the case, then we could automatically query it in journeys() if opt.tickets is true.

I cannot fully follow this. How is refreshJourneys() different than journey()? I tried to find this in the code base, but in the end, this also "just" calls the endpoint with "meth": "Reconstruction", no?

And the refresh token, that is just the ID of the trip?

UPDATE: My bad, I was confused. The journey method only exists in pyhafas, I think (https://github.com/FahrplanDatenGarten/pyhafas/blob/bbc0a5274b944cd67621b0ccd43da8597c49f7b0/pyhafas/client.py#L202). There they call it like that, instead of refreshJourneys. But this method uses "meth": "Reconstruction", and I don't see prices there either.

Why do you think it still returns pices & tickets? Can you explain? :-)

@traines-source
Copy link
Member

traines-source commented Dec 10, 2024

Can't reproduce that: /journeys/T$A=1@O=Frankfurt(Main)Hbf@L=8000105@a=128@$A=1@O=Stuttgart%20Hbf@L=8000096@a=128@$202412181305$202412181438$ICE%20%20575$$1$$$$$$§W$A=1@O=Stuttgart%20Hbf@L=8000096@a=128@$A=1@O=Hauptbf%20(Arnulf-Klett-Platz),%20Stuttgart@L=561603@a=128@$202412181438$202412181450$$$1$$$$$$§T$A=1@O=Hauptbf%20(Arnulf-Klett-Platz),%20Stuttgart@L=561603@a=128@$A=1@O=Hölderlinplatz,%20Stuttgart@L=561469@a=128@$202412181451$202412181458$Bus%20%20%2040$$1$$$$$$
returns no price (edit: also checked with new HAFAS version 1.78, no change :/). Maybe you checked before the timetable change?

And yes, hafas-client should stay a client for HAFAS, but my goal was for any downstream applications to be able to seamlessly replace hafas-client with db-vendo-client. And I figured it couldn't harm to keep the git history.

@derhuerst
Copy link
Member

Maybe you checked before the timetable change?

Oops, I did.

@derhuerst
Copy link
Member

FYI: I have just published [email protected], which updates the DB profile to ver to 1.78 and ext to DB.R22.04.a, but AFAICT this hasn't changed anything about the missing prices/fares/tickets data.

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

No branches or pull requests

3 participants