apyefa 0.0.3__py3-none-any.whl → 0.0.4__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,6 +4,7 @@ import aiohttp
4
4
 
5
5
  from apyefa.commands import (
6
6
  Command,
7
+ CommandAdditionalInfo,
7
8
  CommandDepartures,
8
9
  CommandServingLines,
9
10
  CommandStopFinder,
@@ -163,7 +164,7 @@ class EfaClient:
163
164
  return command.parse(response)
164
165
 
165
166
  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
167
+ """Search for lines that pass `location`. Location can be location ID like `de:08111:6221` or a `Location` object
167
168
 
168
169
  Args:
169
170
  location (str | Location): Location
@@ -193,6 +194,15 @@ class EfaClient:
193
194
  async def locations_by_line(self, line: str | Line) -> list[Location]:
194
195
  raise NotImplementedError
195
196
 
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
+
196
206
  async def _run_query(self, query: str) -> str:
197
207
  _LOGGER.info(f"Run query {query}")
198
208
 
@@ -1,4 +1,5 @@
1
1
  from .command import Command
2
+ from .command_add_info import CommandAdditionalInfo
2
3
  from .command_departures import CommandDepartures
3
4
  from .command_serving_lines import CommandServingLines
4
5
  from .command_stop_finder import CommandStopFinder
@@ -8,6 +9,7 @@ from .command_trip import CommandTrip
8
9
  __all__ = [
9
10
  "Command",
10
11
  "CommandDepartures",
12
+ "CommandAdditionalInfo",
11
13
  "CommandStopFinder",
12
14
  "CommandSystemInfo",
13
15
  "CommandTrip",
@@ -0,0 +1,51 @@
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
+ )
@@ -48,7 +48,7 @@ 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"): list[0, 2, 4, 8, 16],
52
52
  Optional("mergeDir"): Any("0", "1", 0, 1),
53
53
  Optional("lsShowTrainsExplicit"): Any("0", "1", 0, 1),
54
54
  Optional("line"): str,
@@ -41,6 +41,10 @@ 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,
44
48
  Optional("anyObjFilter_origin"): Range(
45
49
  min=0, max=sum([x.value for x in LocationFilter])
46
50
  ),
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):
@@ -63,7 +93,8 @@ SCHEMA_PROPERTIES = vol.Schema(
63
93
  vol.Optional("area"): str,
64
94
  vol.Optional("platform"): str,
65
95
  vol.Optional("platformName"): str,
66
- }
96
+ },
97
+ extra=vol.ALLOW_EXTRA,
67
98
  )
68
99
 
69
100
  SCHEMA_LINE_PROPERTIES: Final = vol.Schema(
@@ -143,14 +174,14 @@ SCHEMA_TRANSPORTATION: Final = vol.Schema(
143
174
  {
144
175
  vol.Required("id"): str,
145
176
  vol.Required("name"): str,
146
- vol.Required("disassembledName"): str,
147
177
  vol.Required("number"): str,
148
- vol.Required("description"): str,
149
178
  vol.Required("product"): SCHEMA_PRODUCT,
179
+ vol.Optional("description"): str,
150
180
  vol.Optional("operator"): SCHEMA_OPERATOR,
151
181
  vol.Optional("destination"): SCHEMA_LOCATION,
152
182
  vol.Optional("origin"): SCHEMA_LOCATION,
153
183
  vol.Optional("properties"): dict,
184
+ vol.Optional("disassembledName"): str,
154
185
  }
155
186
  )
156
187
 
@@ -181,7 +212,8 @@ SCHEMA_DEPARTURE: Final = vol.Schema(
181
212
  vol.Required("transportation"): SCHEMA_TRANSPORTATION,
182
213
  vol.Optional("infos"): list,
183
214
  vol.Optional("hints"): list,
184
- }
215
+ },
216
+ extra=vol.ALLOW_EXTRA,
185
217
  )
186
218
 
187
219
 
@@ -367,7 +399,8 @@ class Line(_Base):
367
399
  # number = data.get("number")
368
400
  description = data.get("description")
369
401
  product = TransportType(data.get("product").get("class"))
370
- operator = data.get("operator").get("name")
402
+ # operator = data.get("operator", None).get("name", None)
403
+ operator = "None"
371
404
  destination = Location.from_dict(data.get("destination"))
372
405
  origin = Location.from_dict(data.get("origin"))
373
406
  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.4
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
@@ -1,21 +1,22 @@
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=lwAATLU_-QlAkE_n1kqn2BymvWngH84RDb2D2Z1DYbo,6857
3
+ apyefa/data_classes.py,sha256=KKNYuVHF2d_U-CGxmkyf2RoWCP0GPUvWrrzafytxS_0,11392
4
4
  apyefa/exceptions.py,sha256=Vhc8FEtI1xSxbVRLFXd3BlNTekY2w3byEvd3Jhhg8h4,240
5
5
  apyefa/helpers.py,sha256=EJyj-Pw3xDrn8WKGbpfqbnaUZjHtVrE2A2LYpTkACps,1695
6
- apyefa/commands/__init__.py,sha256=kC7Zr8IcahAN8xEOytDUS6WCADQ5oe_nqDIPAjlzxy4,425
6
+ apyefa/commands/__init__.py,sha256=_E7sD_tVa7xI7vUN1EJUwHovSU1xg0RFtbnQb7be1sQ,506
7
7
  apyefa/commands/command.py,sha256=wq3rEaYd3NUpkNqo2sX3Yw9-lcRerp8scAy2SVpx1hs,3577
8
+ apyefa/commands/command_add_info.py,sha256=7RLV81i6sCKM3fW1DDX3RJz6GvkICqjxDICF_464ppU,1983
8
9
  apyefa/commands/command_departures.py,sha256=kHOyxxSHn7F7ClAV1fQdl1O4cOVRs6a60pkqc8-r_9o,1736
9
- apyefa/commands/command_serving_lines.py,sha256=C8PrMVWCp71fyPzvsTYMmSaYORs60yUNdEShXEawrK0,2021
10
- apyefa/commands/command_stop_finder.py,sha256=oDCbjVoQVK_ARDEdmHXuaUJ-IJA0P6f99cVDRS2hqT8,1688
10
+ apyefa/commands/command_serving_lines.py,sha256=NAS_9cvTq7-Lc9lFEFgVsWavEA730FH1UYqohOCDnR0,2038
11
+ apyefa/commands/command_stop_finder.py,sha256=SXi09wA5fmGxEcMEu3XYEK4mpth-bKUoRzDyspDATWo,1944
11
12
  apyefa/commands/command_system_info.py,sha256=0bQ0oYbp7FFqPA1b5RgaxANm9-BYlN5KiwRILCCuDVY,783
12
13
  apyefa/commands/command_trip.py,sha256=kOlchWyBRlvWBqwjqpx130VXEh5kly6KMSv_pgCBljs,1095
13
14
  apyefa/commands/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
15
  apyefa/commands/parsers/parser.py,sha256=1PSlLpfYrNeKRTpvCcYsCzAKlNrs0oHvSN7zpF4Xcs8,140
15
16
  apyefa/commands/parsers/rapid_json_parser.py,sha256=UMexRiMKkJLcK5EEj80B6RYkWBuR8ZWD3YpeGa0J3lQ,212
16
17
  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,,
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,,
File without changes