apyefa 0.0.3__tar.gz → 0.0.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.

Potentially problematic release.


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

Files changed (49) hide show
  1. {apyefa-0.0.3 → apyefa-0.0.4}/PKG-INFO +2 -2
  2. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/client.py +11 -1
  3. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/__init__.py +2 -0
  4. apyefa-0.0.4/apyefa/commands/command_add_info.py +51 -0
  5. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/command_serving_lines.py +1 -1
  6. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/command_stop_finder.py +4 -0
  7. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/data_classes.py +42 -9
  8. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa.egg-info/PKG-INFO +2 -2
  9. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa.egg-info/SOURCES.txt +1 -0
  10. {apyefa-0.0.3 → apyefa-0.0.4}/examples.py +7 -4
  11. {apyefa-0.0.3 → apyefa-0.0.4}/pyproject.toml +2 -2
  12. {apyefa-0.0.3 → apyefa-0.0.4}/.github/workflows/python-package.yml +0 -0
  13. {apyefa-0.0.3 → apyefa-0.0.4}/.gitignore +0 -0
  14. {apyefa-0.0.3 → apyefa-0.0.4}/.vscode/settings.json +0 -0
  15. {apyefa-0.0.3 → apyefa-0.0.4}/LICENSE +0 -0
  16. {apyefa-0.0.3 → apyefa-0.0.4}/README.md +0 -0
  17. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/__init__.py +0 -0
  18. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/command.py +0 -0
  19. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/command_departures.py +0 -0
  20. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/command_system_info.py +0 -0
  21. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/command_trip.py +0 -0
  22. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/parsers/__init__.py +0 -0
  23. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/parsers/parser.py +0 -0
  24. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/parsers/rapid_json_parser.py +0 -0
  25. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/commands/parsers/xml_parser.py +0 -0
  26. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/exceptions.py +0 -0
  27. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa/helpers.py +0 -0
  28. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa.egg-info/dependency_links.txt +0 -0
  29. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa.egg-info/requires.txt +0 -0
  30. {apyefa-0.0.3 → apyefa-0.0.4}/apyefa.egg-info/top_level.txt +0 -0
  31. {apyefa-0.0.3 → apyefa-0.0.4}/setup.cfg +0 -0
  32. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/__init__.py +0 -0
  33. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/parsers/__init__.py +0 -0
  34. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/parsers/test_json_parser.py +0 -0
  35. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/parsers/test_xml_parser.py +0 -0
  36. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/test_cmd.py +0 -0
  37. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/test_cmd_departures.py +0 -0
  38. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/test_cmd_serving_lines.py +0 -0
  39. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/test_cmd_stop_finder.py +0 -0
  40. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/test_cmd_system_info.py +0 -0
  41. {apyefa-0.0.3 → apyefa-0.0.4}/tests/commands/test_commands.py +0 -0
  42. {apyefa-0.0.3 → apyefa-0.0.4}/tests/conftest.py +0 -0
  43. {apyefa-0.0.3 → apyefa-0.0.4}/tests/data_classes/__init__.py +0 -0
  44. {apyefa-0.0.3 → apyefa-0.0.4}/tests/data_classes/test_departure.py +0 -0
  45. {apyefa-0.0.3 → apyefa-0.0.4}/tests/data_classes/test_location.py +0 -0
  46. {apyefa-0.0.3 → apyefa-0.0.4}/tests/data_classes/test_system_info.py +0 -0
  47. {apyefa-0.0.3 → apyefa-0.0.4}/tests/data_classes/test_transportation.py +0 -0
  48. {apyefa-0.0.3 → apyefa-0.0.4}/tests/test_client.py +0 -0
  49. {apyefa-0.0.3 → apyefa-0.0.4}/tests/test_helpers.py +0 -0
@@ -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
@@ -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
  ),
@@ -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
@@ -17,6 +17,7 @@ apyefa.egg-info/requires.txt
17
17
  apyefa.egg-info/top_level.txt
18
18
  apyefa/commands/__init__.py
19
19
  apyefa/commands/command.py
20
+ apyefa/commands/command_add_info.py
20
21
  apyefa/commands/command_departures.py
21
22
  apyefa/commands/command_serving_lines.py
22
23
  apyefa/commands/command_stop_finder.py
@@ -1,15 +1,18 @@
1
1
  import asyncio
2
- from apyefa import EfaClient, StopFilter
3
2
  from pprint import pprint
4
3
 
4
+ from apyefa import EfaClient, LocationFilter
5
+
5
6
 
6
7
  async def main():
7
8
  async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
8
9
  result = await asyncio.gather(
9
10
  client.info(),
10
- client.stops("Nürnberg Plärrer"),
11
- client.stops("Nordostbahnhof", filters=[StopFilter.STOPS]),
12
- client.departures("de:09564:704", limit=10, date="20241126 16:30"),
11
+ client.locations_by_name("Nürnberg Plärrer"),
12
+ client.locations_by_name("Nordostbahnhof", filters=[LocationFilter.STOPS]),
13
+ client.departures_by_location(
14
+ "de:09564:704", limit=10, date="20241126 16:30"
15
+ ),
13
16
  )
14
17
 
15
18
  print("System Info".center(60, "-"))
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "apyefa"
10
- version = "0.0.3"
10
+ version = "0.0.4"
11
11
  requires-python = ">= 3.11"
12
12
  description = "Python API for EFA(Elektronische Fahrplanauskunft) async requests"
13
13
  authors = [
@@ -15,7 +15,7 @@ authors = [
15
15
  ]
16
16
  readme = "README.md"
17
17
  license = {file = "LICENSE"}
18
- keywords = ["efa", "vgn", "gtfs", "public transport", "traffic"]
18
+ keywords = ["efa", "public transport", "traffic"]
19
19
 
20
20
  dependencies = [
21
21
  "aiohttp>=3.11.7",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes