python-openpublictransport 0.3.3__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/PKG-INFO +1 -1
  2. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/pyproject.toml +1 -1
  3. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/hafas_mgate_base.py +13 -1
  4. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/python_openpublictransport.egg-info/PKG-INFO +1 -1
  5. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_german_regional_providers.py +21 -0
  6. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/setup.cfg +0 -0
  7. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/__init__.py +0 -0
  8. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/const.py +0 -0
  9. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/data/uk_stations.json +0 -0
  10. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/exceptions.py +0 -0
  11. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/models.py +0 -0
  12. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/parsers.py +0 -0
  13. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/__init__.py +0 -0
  14. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/avv.py +0 -0
  15. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/bart.py +0 -0
  16. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/base.py +0 -0
  17. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/beg.py +0 -0
  18. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/bsvg.py +0 -0
  19. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/bvg.py +0 -0
  20. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/cta.py +0 -0
  21. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/dart.py +0 -0
  22. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/db.py +0 -0
  23. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/digitransit.py +0 -0
  24. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/ding.py +0 -0
  25. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/efa_base.py +0 -0
  26. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/entur.py +0 -0
  27. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/fptf_base.py +0 -0
  28. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/golemio.py +0 -0
  29. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/gvh.py +0 -0
  30. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/hafas_base.py +0 -0
  31. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/hongkong.py +0 -0
  32. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/hvv.py +0 -0
  33. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/hvv_gti.py +0 -0
  34. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/insa.py +0 -0
  35. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/irail.py +0 -0
  36. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/irishrail.py +0 -0
  37. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/kvv.py +0 -0
  38. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/mobiliteit_lu.py +0 -0
  39. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/mvv.py +0 -0
  40. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/nahsh.py +0 -0
  41. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/national_rail.py +0 -0
  42. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/nextbus_base.py +0 -0
  43. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/ns.py +0 -0
  44. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/nta.py +0 -0
  45. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/nvbw.py +0 -0
  46. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/nvv.py +0 -0
  47. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/nwl.py +0 -0
  48. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/oebb.py +0 -0
  49. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/otp.py +0 -0
  50. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/otp_base.py +0 -0
  51. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/otp_custom.py +0 -0
  52. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/rejseplanen.py +0 -0
  53. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/rmv.py +0 -0
  54. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/rvv.py +0 -0
  55. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/saarvv.py +0 -0
  56. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/sbb.py +0 -0
  57. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/sl.py +0 -0
  58. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/tfl.py +0 -0
  59. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/tfnsw.py +0 -0
  60. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/tpg.py +0 -0
  61. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/trafiklab.py +0 -0
  62. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/transitous.py +0 -0
  63. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/trias_base.py +0 -0
  64. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/trimet.py +0 -0
  65. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/ttc.py +0 -0
  66. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vagfr.py +0 -0
  67. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vao.py +0 -0
  68. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vbn.py +0 -0
  69. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vbn_hafas.py +0 -0
  70. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vgn.py +0 -0
  71. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vmt.py +0 -0
  72. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vmv.py +0 -0
  73. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vos.py +0 -0
  74. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vrn.py +0 -0
  75. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vrr.py +0 -0
  76. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vsn.py +0 -0
  77. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vvo.py +0 -0
  78. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/vvs.py +0 -0
  79. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/providers/wienerlinien.py +0 -0
  80. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/openpublictransport/py.typed +0 -0
  81. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/python_openpublictransport.egg-info/SOURCES.txt +0 -0
  82. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/python_openpublictransport.egg-info/dependency_links.txt +0 -0
  83. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/python_openpublictransport.egg-info/requires.txt +0 -0
  84. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/src/python_openpublictransport.egg-info/top_level.txt +0 -0
  85. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_cta.py +0 -0
  86. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_digitransit.py +0 -0
  87. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_disruptions.py +0 -0
  88. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_efa_mimetype.py +0 -0
  89. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_efa_platform.py +0 -0
  90. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_entur.py +0 -0
  91. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_golemio.py +0 -0
  92. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_hafas_base.py +0 -0
  93. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_hafas_mgate.py +0 -0
  94. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_hongkong.py +0 -0
  95. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_http_errors.py +0 -0
  96. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_hvv_gti.py +0 -0
  97. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_irail.py +0 -0
  98. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_issue_fixes_0_3_1.py +0 -0
  99. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_national_rail.py +0 -0
  100. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_national_rail_parse.py +0 -0
  101. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_national_rail_static.py +0 -0
  102. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_provider_expansion.py +0 -0
  103. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_sbb.py +0 -0
  104. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_sl.py +0 -0
  105. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_tfl.py +0 -0
  106. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_tfnsw.py +0 -0
  107. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_ttc.py +0 -0
  108. {python_openpublictransport-0.3.3 → python_openpublictransport-0.3.4}/tests/test_wienerlinien.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-openpublictransport
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Python library for public transport APIs (EFA, OTP2, TRIAS, FPTF, HAFAS, GTFS-RT)
5
5
  License: MIT
6
6
  Requires-Python: >=3.11
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-openpublictransport"
7
- version = "0.3.3"
7
+ version = "0.3.4"
8
8
  description = "Python library for public transport APIs (EFA, OTP2, TRIAS, FPTF, HAFAS, GTFS-RT)"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -328,6 +328,8 @@ class HafasMgateBaseProvider(BaseProvider):
328
328
  departure_time: Optional[datetime] = None,
329
329
  results: int = 4,
330
330
  arrival_time: Optional[datetime] = None,
331
+ via_id: Optional[str] = None,
332
+ via_dwell_minutes: Optional[int] = None,
331
333
  ) -> List[Dict[str, Any]]:
332
334
  """Plan journeys between two stops with the mgate ``TripSearch`` service.
333
335
 
@@ -335,7 +337,12 @@ class HafasMgateBaseProvider(BaseProvider):
335
337
  the search starts now. ``arrival_time`` switches to an "arrive by"
336
338
  search instead (like hafas-client's ``arrival`` option, ``outFrwd``
337
339
  false): the connections that arrive by then. It wins over
338
- ``departure_time``. Returns one dict per connection::
340
+ ``departure_time``.
341
+
342
+ ``via_id`` routes every connection through that stop (mgate
343
+ ``viaLocL``); ``via_dwell_minutes`` asks for at least that long a stay
344
+ there (the entry's ``min``). Without a via the dwell time is ignored.
345
+ Returns one dict per connection::
339
346
 
340
347
  {"duration_minutes": int, "transfers": int, "legs": [leg, ...]}
341
348
 
@@ -360,6 +367,11 @@ class HafasMgateBaseProvider(BaseProvider):
360
367
  "getPolyline": False,
361
368
  },
362
369
  }
370
+ if via_id:
371
+ via: Dict[str, Any] = {"loc": self._location(via_id)}
372
+ if via_dwell_minutes and via_dwell_minutes > 0:
373
+ via["min"] = int(via_dwell_minutes)
374
+ svc["req"]["viaLocL"] = [via]
363
375
  res = await self._mgate_request(svc)
364
376
  if not res:
365
377
  return []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-openpublictransport
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Python library for public transport APIs (EFA, OTP2, TRIAS, FPTF, HAFAS, GTFS-RT)
5
5
  License: MIT
6
6
  Requires-Python: >=3.11
@@ -221,3 +221,24 @@ async def test_search_trips_departure_stays_forward():
221
221
  provider._request = AsyncMock(return_value={"svcResL": [{"res": {}}]})
222
222
  await provider.search_trips("A=1@L=1@", "A=1@L=2@")
223
223
  assert json.loads(provider._request.call_args.kwargs["data"])["svcReqL"][0]["req"]["outFrwd"] is True
224
+
225
+
226
+ async def test_search_trips_via_with_dwell_time():
227
+ """A via stop goes into viaLocL; a dwell time becomes its minimum stay."""
228
+ provider = NAHSHProvider(session=None)
229
+ provider._request = AsyncMock(return_value={"svcResL": [{"res": {}}]})
230
+
231
+ await provider.search_trips("A=1@L=1@", "A=1@L=2@", via_id="A=1@L=3@", via_dwell_minutes=30)
232
+ req = json.loads(provider._request.call_args.kwargs["data"])["svcReqL"][0]["req"]
233
+ assert req["viaLocL"] == [{"loc": {"lid": "A=1@L=3@"}, "min": 30}]
234
+
235
+ await provider.search_trips("A=1@L=1@", "A=1@L=2@", via_id="8000323")
236
+ req = json.loads(provider._request.call_args.kwargs["data"])["svcReqL"][0]["req"]
237
+ assert req["viaLocL"] == [{"loc": {"type": "S", "extId": "8000323"}}]
238
+
239
+
240
+ async def test_search_trips_without_via_sends_no_via():
241
+ provider = NAHSHProvider(session=None)
242
+ provider._request = AsyncMock(return_value={"svcResL": [{"res": {}}]})
243
+ await provider.search_trips("A=1@L=1@", "A=1@L=2@", via_dwell_minutes=15)
244
+ assert "viaLocL" not in json.loads(provider._request.call_args.kwargs["data"])["svcReqL"][0]["req"]