apyefa 0.0.4__py3-none-any.whl → 0.0.5__py3-none-any.whl

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.

Potentially problematic release.


This version of apyefa might be problematic. Click here for more details.

apyefa/client.py CHANGED
@@ -4,7 +4,6 @@ import aiohttp
4
4
 
5
5
  from apyefa.commands import (
6
6
  Command,
7
- CommandAdditionalInfo,
8
7
  CommandDepartures,
9
8
  CommandServingLines,
10
9
  CommandStopFinder,
@@ -14,6 +13,7 @@ from apyefa.data_classes import (
14
13
  CoordFormat,
15
14
  Departure,
16
15
  Line,
16
+ LineRequestType,
17
17
  Location,
18
18
  LocationFilter,
19
19
  LocationType,
@@ -163,20 +163,24 @@ class EfaClient:
163
163
 
164
164
  return command.parse(response)
165
165
 
166
- async def lines_by_location(self, location: str | Location) -> list[Line]:
166
+ async def lines_by_location(
167
+ self, location: str | Location, req_types: list[LineRequestType] = []
168
+ ) -> list[Line]:
167
169
  """Search for lines that pass `location`. Location can be location ID like `de:08111:6221` or a `Location` object
168
170
 
169
171
  Args:
170
172
  location (str | Location): Location
173
+ req_types (list[LineRequestType], optional): List of types for the request. Defaults to empty.
171
174
 
172
175
  Raises:
173
- ValueError: If not a stop location provided but e.g. POI or Address
176
+ ValueError: Wrong location type provided e.g. LocationType.POI or LocationType.ADDRESS
174
177
 
175
178
  Returns:
176
179
  list[Transport]: List of lines
177
180
  """
178
181
  _LOGGER.info("Request lines by location")
179
182
  _LOGGER.debug(f"location:{location}")
183
+ _LOGGER.debug(f"filters :{req_types}")
180
184
 
181
185
  if isinstance(location, Location):
182
186
  if location.loc_type != LocationType.STOP:
@@ -187,6 +191,9 @@ class EfaClient:
187
191
 
188
192
  command = CommandServingLines("odv", location)
189
193
 
194
+ if req_types:
195
+ command.add_param("lineReqType", sum(req_types))
196
+
190
197
  response = await self._run_query(self._build_url(command))
191
198
 
192
199
  return command.parse(response)
@@ -194,15 +201,6 @@ class EfaClient:
194
201
  async def locations_by_line(self, line: str | Line) -> list[Location]:
195
202
  raise NotImplementedError
196
203
 
197
- async def additional_info(self):
198
- _LOGGER.info("Request additional info")
199
-
200
- command = CommandAdditionalInfo()
201
-
202
- response = await self._run_query(self._build_url(command))
203
-
204
- return command.parse(response)
205
-
206
204
  async def _run_query(self, query: str) -> str:
207
205
  _LOGGER.info(f"Run query {query}")
208
206
 
@@ -1,5 +1,4 @@
1
1
  from .command import Command
2
- from .command_add_info import CommandAdditionalInfo
3
2
  from .command_departures import CommandDepartures
4
3
  from .command_serving_lines import CommandServingLines
5
4
  from .command_stop_finder import CommandStopFinder
@@ -9,7 +8,6 @@ from .command_trip import CommandTrip
9
8
  __all__ = [
10
9
  "Command",
11
10
  "CommandDepartures",
12
- "CommandAdditionalInfo",
13
11
  "CommandStopFinder",
14
12
  "CommandSystemInfo",
15
13
  "CommandTrip",
@@ -1,9 +1,9 @@
1
1
  import logging
2
2
 
3
- from voluptuous import Any, Optional, Required, Schema
3
+ from voluptuous import Any, Optional, Range, Required, Schema
4
4
 
5
5
  from apyefa.commands.command import Command
6
- from apyefa.data_classes import Line
6
+ from apyefa.data_classes import Line, LineRequestType
7
7
 
8
8
  _LOGGER = logging.getLogger(__name__)
9
9
 
@@ -48,7 +48,9 @@ class CommandServingLines(Command):
48
48
  Optional("name_sl"): str,
49
49
  # mode 'line'
50
50
  Optional("lineName"): str,
51
- Optional("lineReqType"): list[0, 2, 4, 8, 16],
51
+ Optional("lineReqType"): Range(
52
+ min=0, max=sum([x.value for x in LineRequestType])
53
+ ),
52
54
  Optional("mergeDir"): Any("0", "1", 0, 1),
53
55
  Optional("lsShowTrainsExplicit"): Any("0", "1", 0, 1),
54
56
  Optional("line"): str,
@@ -41,10 +41,6 @@ class CommandStopFinder(Command):
41
41
  Optional("anyResSort_sf"): str,
42
42
  Optional("anyObjFilter_sf"): int,
43
43
  Optional("doNotSearchForStops_sf"): Any("0", "1", 0, 1),
44
- Optional("locationInfoActive_sf"): Any("0", "1", 0, 1),
45
- Optional("useHouseNumberList_sf"): Any("0", "1", 0, 1),
46
- Optional("useLocalityMainStop"): Any("0", "1", 0, 1),
47
- Optional("prMinQu"): int,
48
44
  Optional("anyObjFilter_origin"): Range(
49
45
  min=0, max=sum([x.value for x in LocationFilter])
50
46
  ),
apyefa/data_classes.py CHANGED
@@ -76,6 +76,15 @@ class LocationFilter(IntEnum):
76
76
  POST_CODES = 64
77
77
 
78
78
 
79
+ class LineRequestType(IntEnum):
80
+ NONE = 0
81
+ DEPARTURE_MONITOR = 1
82
+ STOP_TIMETABLE = 2
83
+ TIMETABLE = 4
84
+ ROUTE_MAPS = 8
85
+ STATION_TIMETABLE = 16
86
+
87
+
79
88
  class CoordFormat(StrEnum):
80
89
  WGS84 = "WGS84[dd.ddddd]"
81
90
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apyefa
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Python API for EFA(Elektronische Fahrplanauskunft) async requests
5
5
  Author-email: Alex Jung <jungdevelop@gmail.com>
6
6
  License: MIT License
@@ -280,14 +280,13 @@ Find lines pass provided location.
280
280
  |Arguments|Type |Required|Description|
281
281
  |---------|--------------------|--------|-----------|
282
282
  |location |str \| [Location](#location) |required|The location passed by searched line(s)|
283
+ |req_types|list[[LineRequestType](#lineRequestType)]|optional|The result presentation type(s) can be defined with this argument. Default value is `[]`
283
284
 
284
285
  ### Return value
285
286
  |Type|Description|
286
287
  |----|-----------|
287
288
  |list[[Line](#line)]|List of lines found for provided location|
288
289
 
289
- > The attribute `origin` of returned `line` objects is None
290
-
291
290
  ### Examples
292
291
  ``` python
293
292
  async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
@@ -367,17 +366,37 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
367
366
  ## TransportType
368
367
  ```python
369
368
  class TransportType(IntEnum):
370
- RAIL = 0
371
- SUBURBAN = 1
372
- SUBWAY = 2
373
- CITY_RAIL = 3
374
- TRAM = 4
375
- BUS = 5
376
- RBUS = 6
377
- EXPRESS_BUS = 7
378
- CABLE_TRAM = 8
379
- FERRY = 9
380
- AST = 10 # Anruf-Sammel-Taxi
369
+ TRAIN = 0 # Zug
370
+ SUBURBAN = 1 # S-Bahn
371
+ SUBWAY = 2 # U-Bahn
372
+ CITY_RAIL = 3 # Stadtbahn
373
+ TRAM = 4 # Straßenbahn
374
+ CITY_BUS = 5 # Stadtbus
375
+ REGIONAL_BUS = 6 # Regionalbus
376
+ EXPRESS_BUS = 7 # Schnellbus
377
+ CABLE_RAIL = 8 # Seilbahn
378
+ FERRY = 9 # Schief
379
+ AST = 10 # Anruf-Sammel-Taxi
380
+ SUSPENSION_RAIL = 11 # Schwebebahn
381
+ AIRPLANE = 12 # Flugzeug
382
+ REGIONAL_TRAIN = 13 # Reginalzug (z.B. IRE, RE und RB)
383
+ NATIONAL_TRAIN = 14 # Nationaler Zug (z.B. IR und D)
384
+ INTERNATINAL_TRAIN = 15 # Internationaler Zug (z.B. IC und EC)
385
+ HIGH_SPEED_TRAIN = 16 # Hochgeschwindigkeitzüge (z.B. ICE)
386
+ RAIL_REPLACEMENT_TRANSPORT = 17 # Schienenersatzverkehr
387
+ SHUTTLE_TRAIN = 18 # Schuttlezug
388
+ CITIZEN_BUS = 19 # Bürgerbus
389
+ ```
390
+
391
+ ## LineRequestType
392
+ ```python
393
+ class LineRequestType(IntEnum):
394
+ NONE = 0
395
+ DEPARTURE_MONITOR = 1
396
+ STOP_TIMETABLE = 2
397
+ TIMETABLE = 4
398
+ ROUTE_MAPS = 8
399
+ STATION_TIMETABLE = 16
381
400
  ```
382
401
 
383
402
  ## CoordFormat
@@ -1,22 +1,21 @@
1
1
  apyefa/__init__.py,sha256=kohSwa1VlugPyxKa0QZqQFwRi4hIGrKFd74W7NDgunA,342
2
- apyefa/client.py,sha256=lwAATLU_-QlAkE_n1kqn2BymvWngH84RDb2D2Z1DYbo,6857
3
- apyefa/data_classes.py,sha256=KKNYuVHF2d_U-CGxmkyf2RoWCP0GPUvWrrzafytxS_0,11392
2
+ apyefa/client.py,sha256=UYt1kvxvPjg-VfdlUqPsazyEdc97J27_DMoprjF8C8g,6924
3
+ apyefa/data_classes.py,sha256=Njt7r8ONEY5KxUz9uVFnPHU9qz9sp5RWmmhiR8ywDiY,11552
4
4
  apyefa/exceptions.py,sha256=Vhc8FEtI1xSxbVRLFXd3BlNTekY2w3byEvd3Jhhg8h4,240
5
5
  apyefa/helpers.py,sha256=EJyj-Pw3xDrn8WKGbpfqbnaUZjHtVrE2A2LYpTkACps,1695
6
- apyefa/commands/__init__.py,sha256=_E7sD_tVa7xI7vUN1EJUwHovSU1xg0RFtbnQb7be1sQ,506
6
+ apyefa/commands/__init__.py,sha256=kC7Zr8IcahAN8xEOytDUS6WCADQ5oe_nqDIPAjlzxy4,425
7
7
  apyefa/commands/command.py,sha256=wq3rEaYd3NUpkNqo2sX3Yw9-lcRerp8scAy2SVpx1hs,3577
8
- apyefa/commands/command_add_info.py,sha256=7RLV81i6sCKM3fW1DDX3RJz6GvkICqjxDICF_464ppU,1983
9
8
  apyefa/commands/command_departures.py,sha256=kHOyxxSHn7F7ClAV1fQdl1O4cOVRs6a60pkqc8-r_9o,1736
10
- apyefa/commands/command_serving_lines.py,sha256=NAS_9cvTq7-Lc9lFEFgVsWavEA730FH1UYqohOCDnR0,2038
11
- apyefa/commands/command_stop_finder.py,sha256=SXi09wA5fmGxEcMEu3XYEK4mpth-bKUoRzDyspDATWo,1944
9
+ apyefa/commands/command_serving_lines.py,sha256=V-HVYgFyeEWBLebKbp6NNXshxw0fVPttGZLu-CTmFC4,2137
10
+ apyefa/commands/command_stop_finder.py,sha256=oDCbjVoQVK_ARDEdmHXuaUJ-IJA0P6f99cVDRS2hqT8,1688
12
11
  apyefa/commands/command_system_info.py,sha256=0bQ0oYbp7FFqPA1b5RgaxANm9-BYlN5KiwRILCCuDVY,783
13
12
  apyefa/commands/command_trip.py,sha256=kOlchWyBRlvWBqwjqpx130VXEh5kly6KMSv_pgCBljs,1095
14
13
  apyefa/commands/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
14
  apyefa/commands/parsers/parser.py,sha256=1PSlLpfYrNeKRTpvCcYsCzAKlNrs0oHvSN7zpF4Xcs8,140
16
15
  apyefa/commands/parsers/rapid_json_parser.py,sha256=UMexRiMKkJLcK5EEj80B6RYkWBuR8ZWD3YpeGa0J3lQ,212
17
16
  apyefa/commands/parsers/xml_parser.py,sha256=ru52QtBP68KoTZ8OgjFWrLy-PD4_j1miY8Zv5umNSE8,151
18
- apyefa-0.0.4.dist-info/LICENSE,sha256=C2Gdvb1B39BeEP-RGqVd7w6j94GnJo4gnYyiC_l3SFQ,1066
19
- apyefa-0.0.4.dist-info/METADATA,sha256=OV6RcIfCeFWX_ta-4_bXp0JC3gr_j-9w5LtTBW1uO6g,15615
20
- apyefa-0.0.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
21
- apyefa-0.0.4.dist-info/top_level.txt,sha256=b9VSv2S7lxdaypCumxO92IEQFpJdFuB8vQs03j5gZxY,7
22
- apyefa-0.0.4.dist-info/RECORD,,
17
+ apyefa-0.0.5.dist-info/LICENSE,sha256=C2Gdvb1B39BeEP-RGqVd7w6j94GnJo4gnYyiC_l3SFQ,1066
18
+ apyefa-0.0.5.dist-info/METADATA,sha256=bop1VP_hhMO9A_9inje-HerUa1uArdE2jkvA1mZUHa0,16750
19
+ apyefa-0.0.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
+ apyefa-0.0.5.dist-info/top_level.txt,sha256=b9VSv2S7lxdaypCumxO92IEQFpJdFuB8vQs03j5gZxY,7
21
+ apyefa-0.0.5.dist-info/RECORD,,
@@ -1,51 +0,0 @@
1
- import logging
2
-
3
- from voluptuous import Any, Optional, Required, Schema
4
-
5
- from apyefa.commands.command import Command
6
-
7
- _LOGGER = logging.getLogger(__name__)
8
-
9
-
10
- class CommandAdditionalInfo(Command):
11
- def __init__(self) -> None:
12
- super().__init__("XML_ADDINFO_REQUEST", "addinfo")
13
-
14
- def parse(self, data: dict):
15
- data = self._get_parser().parse(data)
16
-
17
- result = []
18
-
19
- return result
20
-
21
- def _get_params_schema(self) -> Schema:
22
- return Schema(
23
- {
24
- Required("outputFormat", default="rapidJSON"): Any("rapidJSON"),
25
- Required("coordOutputFormat", default="WGS84"): Any("WGS84"),
26
- Optional("filterDateValid"): str,
27
- Optional("filterDateValidDay"): str,
28
- Optional("filterDateValidMonth"): str,
29
- Optional("filterDateValidYear"): str,
30
- Optional("filterDateValidComponentsActive"): Any("0", "1", 0, 1),
31
- Optional("filterPublicationStatus"): Any("current", "history"),
32
- Optional("filterValidIntervalStart"): str,
33
- Optional("filterValidIntervalEnd"): str,
34
- Optional("filterOMC"): str,
35
- Optional("filterOMC_PlaceID"): str,
36
- Optional("filterLineNumberIntervalStart"): str,
37
- Optional("filterLineNumberIntervalEnd"): str,
38
- Optional("filterMOTType"): str,
39
- Optional("filterPNLineDir"): str,
40
- Optional("filterPNLineSub"): str,
41
- Optional("itdLPxx_selLine"): str,
42
- Optional("itdLPxx_selOperator"): str,
43
- Optional("itdLPxx_selStop"): str,
44
- Optional("line"): str,
45
- Optional("filterInfoID"): str,
46
- Optional("filterInfoType"): str,
47
- Optional("filterPriority"): str,
48
- Optional("filterProviderCode"): str,
49
- Optional("filterSourceSystemName"): str,
50
- }
51
- )
File without changes