apyefa 0.0.3__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
@@ -13,6 +13,7 @@ from apyefa.data_classes import (
13
13
  CoordFormat,
14
14
  Departure,
15
15
  Line,
16
+ LineRequestType,
16
17
  Location,
17
18
  LocationFilter,
18
19
  LocationType,
@@ -162,20 +163,24 @@ class EfaClient:
162
163
 
163
164
  return command.parse(response)
164
165
 
165
- async def lines_by_location(self, location: str | Location) -> list[Line]:
166
- """Search for lines that pass `location`. Location can be location ID like `de:08111:6221` or a Location object
166
+ async def lines_by_location(
167
+ self, location: str | Location, req_types: list[LineRequestType] = []
168
+ ) -> list[Line]:
169
+ """Search for lines that pass `location`. Location can be location ID like `de:08111:6221` or a `Location` object
167
170
 
168
171
  Args:
169
172
  location (str | Location): Location
173
+ req_types (list[LineRequestType], optional): List of types for the request. Defaults to empty.
170
174
 
171
175
  Raises:
172
- 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
173
177
 
174
178
  Returns:
175
179
  list[Transport]: List of lines
176
180
  """
177
181
  _LOGGER.info("Request lines by location")
178
182
  _LOGGER.debug(f"location:{location}")
183
+ _LOGGER.debug(f"filters :{req_types}")
179
184
 
180
185
  if isinstance(location, Location):
181
186
  if location.loc_type != LocationType.STOP:
@@ -186,6 +191,9 @@ class EfaClient:
186
191
 
187
192
  command = CommandServingLines("odv", location)
188
193
 
194
+ if req_types:
195
+ command.add_param("lineReqType", sum(req_types))
196
+
189
197
  response = await self._run_query(self._build_url(command))
190
198
 
191
199
  return command.parse(response)
@@ -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"): int,
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,
apyefa/data_classes.py CHANGED
@@ -21,18 +21,48 @@ class LocationType(StrEnum):
21
21
  UNKNOWN = "unknown"
22
22
 
23
23
 
24
+ class InfoType(StrEnum):
25
+ AREA_INFO = "areaInfo"
26
+ STOP_INFO = "stopInfo"
27
+ STOP_BLOCKING = "stopBlocking"
28
+ LINE_INFO = "lineInfo"
29
+ LINE_BLOCKING = "lineBlocking"
30
+ ROUTE_INFO = "routeInfo"
31
+ ROUTE_BLOCKING = "routeBlocking"
32
+ GENERAL_INFO = "generalInfo"
33
+ BANNER_INFO = "bannerInfo"
34
+ TRAFFIC_INFO = "trafficInformation"
35
+
36
+
37
+ class InfoPriority(StrEnum):
38
+ VERY_LOW = "veryLow"
39
+ LOW = "low"
40
+ NORMAL = "normal"
41
+ HIGH = "high"
42
+ VERY_HIGH = "veryHigh"
43
+
44
+
24
45
  class TransportType(IntEnum):
25
- RAIL = 0 # RB
46
+ TRAIN = 0 # Zug
26
47
  SUBURBAN = 1 # S-Bahn
27
48
  SUBWAY = 2 # U-Bahn
28
49
  CITY_RAIL = 3 # Stadtbahn
29
50
  TRAM = 4 # Straßenbahn
30
- BUS = 5 # Bus
31
- RBUS = 6 # Regional Bus
51
+ CITY_BUS = 5 # Stadtbus
52
+ REGIONAL_BUS = 6 # Regionalbus
32
53
  EXPRESS_BUS = 7 # Schnellbus
33
- CABLE_TRAM = 8 # Seilbahn
54
+ CABLE_RAIL = 8 # Seilbahn
34
55
  FERRY = 9 # Schief
35
56
  AST = 10 # Anruf-Sammel-Taxi
57
+ SUSPENSION_RAIL = 11 # Schwebebahn
58
+ AIRPLANE = 12 # Flugzeug
59
+ REGIONAL_TRAIN = 13 # Reginalzug (z.B. IRE, RE und RB)
60
+ NATIONAL_TRAIN = 14 # Nationaler Zug (z.B. IR und D)
61
+ INTERNATINAL_TRAIN = 15 # Internationaler Zug (z.B. IC und EC)
62
+ HIGH_SPEED_TRAIN = 16 # Hochgeschwindigkeitzüge (z.B. ICE)
63
+ RAIL_REPLACEMENT_TRANSPORT = 17 # Schienenersatzverkehr
64
+ SHUTTLE_TRAIN = 18 # Schuttlezug
65
+ CITIZEN_BUS = 19 # Bürgerbus
36
66
 
37
67
 
38
68
  class LocationFilter(IntEnum):
@@ -46,6 +76,15 @@ class LocationFilter(IntEnum):
46
76
  POST_CODES = 64
47
77
 
48
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
+
49
88
  class CoordFormat(StrEnum):
50
89
  WGS84 = "WGS84[dd.ddddd]"
51
90
 
@@ -63,7 +102,8 @@ SCHEMA_PROPERTIES = vol.Schema(
63
102
  vol.Optional("area"): str,
64
103
  vol.Optional("platform"): str,
65
104
  vol.Optional("platformName"): str,
66
- }
105
+ },
106
+ extra=vol.ALLOW_EXTRA,
67
107
  )
68
108
 
69
109
  SCHEMA_LINE_PROPERTIES: Final = vol.Schema(
@@ -143,14 +183,14 @@ SCHEMA_TRANSPORTATION: Final = vol.Schema(
143
183
  {
144
184
  vol.Required("id"): str,
145
185
  vol.Required("name"): str,
146
- vol.Required("disassembledName"): str,
147
186
  vol.Required("number"): str,
148
- vol.Required("description"): str,
149
187
  vol.Required("product"): SCHEMA_PRODUCT,
188
+ vol.Optional("description"): str,
150
189
  vol.Optional("operator"): SCHEMA_OPERATOR,
151
190
  vol.Optional("destination"): SCHEMA_LOCATION,
152
191
  vol.Optional("origin"): SCHEMA_LOCATION,
153
192
  vol.Optional("properties"): dict,
193
+ vol.Optional("disassembledName"): str,
154
194
  }
155
195
  )
156
196
 
@@ -181,7 +221,8 @@ SCHEMA_DEPARTURE: Final = vol.Schema(
181
221
  vol.Required("transportation"): SCHEMA_TRANSPORTATION,
182
222
  vol.Optional("infos"): list,
183
223
  vol.Optional("hints"): list,
184
- }
224
+ },
225
+ extra=vol.ALLOW_EXTRA,
185
226
  )
186
227
 
187
228
 
@@ -367,7 +408,8 @@ class Line(_Base):
367
408
  # number = data.get("number")
368
409
  description = data.get("description")
369
410
  product = TransportType(data.get("product").get("class"))
370
- operator = data.get("operator").get("name")
411
+ # operator = data.get("operator", None).get("name", None)
412
+ operator = "None"
371
413
  destination = Location.from_dict(data.get("destination"))
372
414
  origin = Location.from_dict(data.get("origin"))
373
415
  properties = data.get("properties", {})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apyefa
3
- Version: 0.0.3
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
@@ -28,7 +28,7 @@ Project-URL: Homepage, https://github.com/alex-jung/apyefa
28
28
  Project-URL: Documentation, https://github.com/alex-jung/apyefa
29
29
  Project-URL: Repository, https://github.com/alex-jung/apyefa
30
30
  Project-URL: Issues, https://github.com/alex-jung/apyefa/issues
31
- Keywords: efa,vgn,gtfs,public transport,traffic
31
+ Keywords: efa,public transport,traffic
32
32
  Requires-Python: >=3.11
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: 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,12 +1,12 @@
1
1
  apyefa/__init__.py,sha256=kohSwa1VlugPyxKa0QZqQFwRi4hIGrKFd74W7NDgunA,342
2
- apyefa/client.py,sha256=mxlxxBMEBRkklWhhbujvN5HpL8QWllSRFwIhkICcmQI,6591
3
- apyefa/data_classes.py,sha256=UccVL6xvq5xs5M_LR4HOYT_cgM4XjsLIriBOqsJbDTs,10335
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
6
  apyefa/commands/__init__.py,sha256=kC7Zr8IcahAN8xEOytDUS6WCADQ5oe_nqDIPAjlzxy4,425
7
7
  apyefa/commands/command.py,sha256=wq3rEaYd3NUpkNqo2sX3Yw9-lcRerp8scAy2SVpx1hs,3577
8
8
  apyefa/commands/command_departures.py,sha256=kHOyxxSHn7F7ClAV1fQdl1O4cOVRs6a60pkqc8-r_9o,1736
9
- apyefa/commands/command_serving_lines.py,sha256=C8PrMVWCp71fyPzvsTYMmSaYORs60yUNdEShXEawrK0,2021
9
+ apyefa/commands/command_serving_lines.py,sha256=V-HVYgFyeEWBLebKbp6NNXshxw0fVPttGZLu-CTmFC4,2137
10
10
  apyefa/commands/command_stop_finder.py,sha256=oDCbjVoQVK_ARDEdmHXuaUJ-IJA0P6f99cVDRS2hqT8,1688
11
11
  apyefa/commands/command_system_info.py,sha256=0bQ0oYbp7FFqPA1b5RgaxANm9-BYlN5KiwRILCCuDVY,783
12
12
  apyefa/commands/command_trip.py,sha256=kOlchWyBRlvWBqwjqpx130VXEh5kly6KMSv_pgCBljs,1095
@@ -14,8 +14,8 @@ apyefa/commands/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
14
14
  apyefa/commands/parsers/parser.py,sha256=1PSlLpfYrNeKRTpvCcYsCzAKlNrs0oHvSN7zpF4Xcs8,140
15
15
  apyefa/commands/parsers/rapid_json_parser.py,sha256=UMexRiMKkJLcK5EEj80B6RYkWBuR8ZWD3YpeGa0J3lQ,212
16
16
  apyefa/commands/parsers/xml_parser.py,sha256=ru52QtBP68KoTZ8OgjFWrLy-PD4_j1miY8Zv5umNSE8,151
17
- apyefa-0.0.3.dist-info/LICENSE,sha256=C2Gdvb1B39BeEP-RGqVd7w6j94GnJo4gnYyiC_l3SFQ,1066
18
- apyefa-0.0.3.dist-info/METADATA,sha256=mcFjLRl8QNUwgYkepVGceQ8TbzlTazk7MbSSqBjpEi8,15624
19
- apyefa-0.0.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
20
- apyefa-0.0.3.dist-info/top_level.txt,sha256=b9VSv2S7lxdaypCumxO92IEQFpJdFuB8vQs03j5gZxY,7
21
- apyefa-0.0.3.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,,
File without changes