Repository: FahrplanDatenGarten/pyhafas (language: python)

Issue:
KVB profile fails with journeys between two local stations
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:

```py
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?
KVB profile fails with journeys between two local stations
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:

```py
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?


Discussion / hints:

Fix patch:
diff --git a/pyhafas/profile/kvb/__init__.py b/pyhafas/profile/kvb/__init__.py
index 5732c39..71cf3f0 100644
--- a/pyhafas/profile/kvb/__init__.py
+++ b/pyhafas/profile/kvb/__init__.py
@@ -36,7 +36,7 @@ class KVBProfile(KVBJourneysRequest, KVBJourneyRequest, BaseProfile):
         'stadtbahn': [2],
         'bus': [8],
         'fernverkehr': [32],
-        'regionalverkehr': [46],
+        'regionalverkehr': [64],
         'taxibus': [256]
     }
 


Test patch:
diff --git a/tests/kvb/request/journeys_test.py b/tests/kvb/request/journeys_test.py
index 8b4e1cb..295bd23 100644
--- a/tests/kvb/request/journeys_test.py
+++ b/tests/kvb/request/journeys_test.py
@@ -4,7 +4,7 @@
 from pyhafas.profile import KVBProfile
 
 
-def test_vsn_journeys_request():
+def test_kvb_journeys_request():
     client = HafasClient(KVBProfile())
     journeys = client.journeys(
         destination="900000687",
@@ -14,3 +14,14 @@ def test_vsn_journeys_request():
         max_changes=-1
     )
     assert journeys
+
+def test_kvb_journeys_local_request():
+    client = HafasClient(KVBProfile())
+    journeys = client.journeys(
+        destination="900000001",
+        origin="900000039",
+        date=datetime.datetime.now(),
+        min_change_time=0,
+        max_changes=-1
+    )
+    assert journeys