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

KVB profile fails with journeys between two local stations #34

Closed
akloeckner opened this issue Jul 13, 2023 · 0 comments · Fixed by #35
Closed

KVB profile fails with journeys between two local stations #34

akloeckner opened this issue Jul 13, 2023 · 0 comments · Fixed by #35

Comments

@akloeckner
Copy link
Contributor

When integrating the work from #28 into my use case, I found that journeys between two local stations result in a JourneysArrivalDepartureTooNearError exception. As soon as one of the stations is a long-distance station, the journeys are retrieved, but seem to take a detour using a long-distance product.

With the DBProfile, this is not an issue.

I do not understand what is happening. But maybe it's more obvious to you. Here's a test script:

import datetime

from pyhafas import HafasClient
from pyhafas.profile import KVBProfile

kvb = HafasClient(KVBProfile())

# This works: Two long-distance stations
departures   = kvb.locations('Köln Hbf')
destinations = kvb.locations('Bahnhof Deutz/Messe')

# This also works: Still one long-distance station
# But: The journey takes a detour through Köln Hbf, although there is a direct stadtbahn connection.
departures   = kvb.locations('Köln Heumarkt')

# This breaks: Two local stations only
# Result: pyhafas.types.exceptions.JourneysArrivalDepartureTooNearError: HAFAS Kernel: No connection found
destinations = kvb.locations('Deutzer Freiheit')

departure = departures[0]
destination = destinations[0]

print(departure)
print(destination)

journeys = kvb.journeys(
        origin=departure,
        destination=destination,
        date=datetime.datetime.now(),
        min_change_time=0,
        max_changes=-1
)

print(journeys)

@1Maxnet1, I'm tagging you as the author of #28 . (Thanks again!) Maybe you have an idea?

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

Successfully merging a pull request may close this issue.

1 participant