apyefa 0.0.4__tar.gz → 0.0.6__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 (53) hide show
  1. apyefa-0.0.6/.github/labeler.yml +14 -0
  2. apyefa-0.0.6/.github/release-drafter.yml +29 -0
  3. apyefa-0.0.6/.github/workflows/labeler.yml +13 -0
  4. apyefa-0.0.6/.github/workflows/release_drafter.yml +15 -0
  5. {apyefa-0.0.4 → apyefa-0.0.6}/PKG-INFO +35 -18
  6. {apyefa-0.0.4 → apyefa-0.0.6}/README.md +34 -17
  7. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/__init__.py +2 -0
  8. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/client.py +12 -16
  9. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/__init__.py +0 -2
  10. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/command.py +3 -1
  11. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/command_departures.py +4 -2
  12. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/command_serving_lines.py +8 -4
  13. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/command_stop_finder.py +4 -2
  14. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/command_system_info.py +4 -2
  15. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/command_trip.py +5 -1
  16. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/data_classes.py +9 -0
  17. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa.egg-info/PKG-INFO +35 -18
  18. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa.egg-info/SOURCES.txt +4 -1
  19. {apyefa-0.0.4 → apyefa-0.0.6}/pyproject.toml +2 -1
  20. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/test_cmd.py +1 -1
  21. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/test_cmd_departures.py +2 -2
  22. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/test_cmd_serving_lines.py +3 -3
  23. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/test_cmd_stop_finder.py +2 -2
  24. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/test_cmd_system_info.py +5 -4
  25. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/test_commands.py +8 -5
  26. apyefa-0.0.4/apyefa/commands/command_add_info.py +0 -51
  27. {apyefa-0.0.4 → apyefa-0.0.6}/.github/workflows/python-package.yml +0 -0
  28. {apyefa-0.0.4 → apyefa-0.0.6}/.gitignore +0 -0
  29. {apyefa-0.0.4 → apyefa-0.0.6}/.vscode/settings.json +0 -0
  30. {apyefa-0.0.4 → apyefa-0.0.6}/LICENSE +0 -0
  31. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/parsers/__init__.py +0 -0
  32. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/parsers/parser.py +0 -0
  33. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/parsers/rapid_json_parser.py +0 -0
  34. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/commands/parsers/xml_parser.py +0 -0
  35. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/exceptions.py +0 -0
  36. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa/helpers.py +0 -0
  37. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa.egg-info/dependency_links.txt +0 -0
  38. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa.egg-info/requires.txt +0 -0
  39. {apyefa-0.0.4 → apyefa-0.0.6}/apyefa.egg-info/top_level.txt +0 -0
  40. {apyefa-0.0.4 → apyefa-0.0.6}/examples.py +0 -0
  41. {apyefa-0.0.4 → apyefa-0.0.6}/setup.cfg +0 -0
  42. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/__init__.py +0 -0
  43. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/parsers/__init__.py +0 -0
  44. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/parsers/test_json_parser.py +0 -0
  45. {apyefa-0.0.4 → apyefa-0.0.6}/tests/commands/parsers/test_xml_parser.py +0 -0
  46. {apyefa-0.0.4 → apyefa-0.0.6}/tests/conftest.py +0 -0
  47. {apyefa-0.0.4 → apyefa-0.0.6}/tests/data_classes/__init__.py +0 -0
  48. {apyefa-0.0.4 → apyefa-0.0.6}/tests/data_classes/test_departure.py +0 -0
  49. {apyefa-0.0.4 → apyefa-0.0.6}/tests/data_classes/test_location.py +0 -0
  50. {apyefa-0.0.4 → apyefa-0.0.6}/tests/data_classes/test_system_info.py +0 -0
  51. {apyefa-0.0.4 → apyefa-0.0.6}/tests/data_classes/test_transportation.py +0 -0
  52. {apyefa-0.0.4 → apyefa-0.0.6}/tests/test_client.py +0 -0
  53. {apyefa-0.0.4 → apyefa-0.0.6}/tests/test_helpers.py +0 -0
@@ -0,0 +1,14 @@
1
+ documentation:
2
+ - changed-files:
3
+ - any-glob-to-any-file: '**/*.md'
4
+
5
+ # Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
6
+ feature:
7
+ - head-branch: ['^feature', 'feature']
8
+
9
+ bugfix:
10
+ - head-branch: ['^bugfix', '^fix']
11
+
12
+ # Add 'release' label to any PR that is opened against the `main` branch
13
+ release:
14
+ - base-branch: 'master'
@@ -0,0 +1,29 @@
1
+ categories:
2
+ - title: ":boom: Breaking Changes"
3
+ label: "breaking"
4
+ - title: ":rocket: Features"
5
+ label: "enhancement"
6
+ - title: ":fire: Removals and Deprecations"
7
+ label: "removal"
8
+ - title: ":beetle: Fixes"
9
+ label: "bug"
10
+ - title: ":racehorse: Performance"
11
+ label: "performance"
12
+ - title: ":rotating_light: Testing"
13
+ label: "testing"
14
+ - title: ":construction_worker: Continuous Integration"
15
+ label: "ci"
16
+ - title: ":books: Documentation"
17
+ label: "documentation"
18
+ - title: ":hammer: Refactoring"
19
+ label: "refactoring"
20
+ - title: ":lipstick: Style"
21
+ label: "style"
22
+ - title: ":package: Dependencies"
23
+ labels:
24
+ - "dependencies"
25
+ - "build"
26
+ template: |
27
+ ## Changes
28
+
29
+ $CHANGES
@@ -0,0 +1,13 @@
1
+ name: "Pull Request Labeler"
2
+ on:
3
+ - pull_request_target
4
+
5
+ jobs:
6
+ labeler:
7
+ permissions:
8
+ contents: read
9
+ pull-requests: write
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: "actions/checkout@v4"
13
+ - uses: "actions/labeler@v5"
@@ -0,0 +1,15 @@
1
+ name: Draft a release note
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ - master
7
+ jobs:
8
+ draft_release:
9
+ name: Release Drafter
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Run release-drafter
13
+ uses: release-drafter/release-drafter@v6.0.0
14
+ env:
15
+ GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apyefa
3
- Version: 0.0.4
3
+ Version: 0.0.6
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
@@ -185,16 +185,14 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
185
185
  ```
186
186
 
187
187
  ## locations_by_coord()
188
- Find localities by coordinates.
189
-
190
- > :x: Currently test endpoint does not sent any answers for this request
188
+ Find localities by their coordinates.
191
189
 
192
190
  ### Arguments
193
191
  |Arguments|Type |Required|Description|
194
192
  |---------|--------------------|--------|-----------|
195
193
  |coord_x |float |required|X-coordinate|
196
194
  |coord_y |float |required|Y-coordinate|
197
- |format |[CoordFormat](#coordformat)|optional|Coordinates format used for request|
195
+ |format |[CoordFormat](#coordformat)|optional|Coordinates format used for request. Default to WGS84.|
198
196
  |limit |int |optional|Max size of returned list. Default value is `10`|
199
197
 
200
198
  ### Return value
@@ -280,14 +278,13 @@ Find lines pass provided location.
280
278
  |Arguments|Type |Required|Description|
281
279
  |---------|--------------------|--------|-----------|
282
280
  |location |str \| [Location](#location) |required|The location passed by searched line(s)|
281
+ |req_types|list[[LineRequestType](#lineRequestType)]|optional|The result presentation type(s) can be defined with this argument. Default value is `[]`
283
282
 
284
283
  ### Return value
285
284
  |Type|Description|
286
285
  |----|-----------|
287
286
  |list[[Line](#line)]|List of lines found for provided location|
288
287
 
289
- > The attribute `origin` of returned `line` objects is None
290
-
291
288
  ### Examples
292
289
  ``` python
293
290
  async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
@@ -367,17 +364,37 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
367
364
  ## TransportType
368
365
  ```python
369
366
  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
367
+ TRAIN = 0 # Zug
368
+ SUBURBAN = 1 # S-Bahn
369
+ SUBWAY = 2 # U-Bahn
370
+ CITY_RAIL = 3 # Stadtbahn
371
+ TRAM = 4 # Straßenbahn
372
+ CITY_BUS = 5 # Stadtbus
373
+ REGIONAL_BUS = 6 # Regionalbus
374
+ EXPRESS_BUS = 7 # Schnellbus
375
+ CABLE_RAIL = 8 # Seilbahn
376
+ FERRY = 9 # Schief
377
+ AST = 10 # Anruf-Sammel-Taxi
378
+ SUSPENSION_RAIL = 11 # Schwebebahn
379
+ AIRPLANE = 12 # Flugzeug
380
+ REGIONAL_TRAIN = 13 # Reginalzug (z.B. IRE, RE und RB)
381
+ NATIONAL_TRAIN = 14 # Nationaler Zug (z.B. IR und D)
382
+ INTERNATINAL_TRAIN = 15 # Internationaler Zug (z.B. IC und EC)
383
+ HIGH_SPEED_TRAIN = 16 # Hochgeschwindigkeitzüge (z.B. ICE)
384
+ RAIL_REPLACEMENT_TRANSPORT = 17 # Schienenersatzverkehr
385
+ SHUTTLE_TRAIN = 18 # Schuttlezug
386
+ CITIZEN_BUS = 19 # Bürgerbus
387
+ ```
388
+
389
+ ## LineRequestType
390
+ ```python
391
+ class LineRequestType(IntEnum):
392
+ NONE = 0
393
+ DEPARTURE_MONITOR = 1
394
+ STOP_TIMETABLE = 2
395
+ TIMETABLE = 4
396
+ ROUTE_MAPS = 8
397
+ STATION_TIMETABLE = 16
381
398
  ```
382
399
 
383
400
  ## CoordFormat
@@ -140,16 +140,14 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
140
140
  ```
141
141
 
142
142
  ## locations_by_coord()
143
- Find localities by coordinates.
144
-
145
- > :x: Currently test endpoint does not sent any answers for this request
143
+ Find localities by their coordinates.
146
144
 
147
145
  ### Arguments
148
146
  |Arguments|Type |Required|Description|
149
147
  |---------|--------------------|--------|-----------|
150
148
  |coord_x |float |required|X-coordinate|
151
149
  |coord_y |float |required|Y-coordinate|
152
- |format |[CoordFormat](#coordformat)|optional|Coordinates format used for request|
150
+ |format |[CoordFormat](#coordformat)|optional|Coordinates format used for request. Default to WGS84.|
153
151
  |limit |int |optional|Max size of returned list. Default value is `10`|
154
152
 
155
153
  ### Return value
@@ -235,14 +233,13 @@ Find lines pass provided location.
235
233
  |Arguments|Type |Required|Description|
236
234
  |---------|--------------------|--------|-----------|
237
235
  |location |str \| [Location](#location) |required|The location passed by searched line(s)|
236
+ |req_types|list[[LineRequestType](#lineRequestType)]|optional|The result presentation type(s) can be defined with this argument. Default value is `[]`
238
237
 
239
238
  ### Return value
240
239
  |Type|Description|
241
240
  |----|-----------|
242
241
  |list[[Line](#line)]|List of lines found for provided location|
243
242
 
244
- > The attribute `origin` of returned `line` objects is None
245
-
246
243
  ### Examples
247
244
  ``` python
248
245
  async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
@@ -322,17 +319,37 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
322
319
  ## TransportType
323
320
  ```python
324
321
  class TransportType(IntEnum):
325
- RAIL = 0
326
- SUBURBAN = 1
327
- SUBWAY = 2
328
- CITY_RAIL = 3
329
- TRAM = 4
330
- BUS = 5
331
- RBUS = 6
332
- EXPRESS_BUS = 7
333
- CABLE_TRAM = 8
334
- FERRY = 9
335
- AST = 10 # Anruf-Sammel-Taxi
322
+ TRAIN = 0 # Zug
323
+ SUBURBAN = 1 # S-Bahn
324
+ SUBWAY = 2 # U-Bahn
325
+ CITY_RAIL = 3 # Stadtbahn
326
+ TRAM = 4 # Straßenbahn
327
+ CITY_BUS = 5 # Stadtbus
328
+ REGIONAL_BUS = 6 # Regionalbus
329
+ EXPRESS_BUS = 7 # Schnellbus
330
+ CABLE_RAIL = 8 # Seilbahn
331
+ FERRY = 9 # Schief
332
+ AST = 10 # Anruf-Sammel-Taxi
333
+ SUSPENSION_RAIL = 11 # Schwebebahn
334
+ AIRPLANE = 12 # Flugzeug
335
+ REGIONAL_TRAIN = 13 # Reginalzug (z.B. IRE, RE und RB)
336
+ NATIONAL_TRAIN = 14 # Nationaler Zug (z.B. IR und D)
337
+ INTERNATINAL_TRAIN = 15 # Internationaler Zug (z.B. IC und EC)
338
+ HIGH_SPEED_TRAIN = 16 # Hochgeschwindigkeitzüge (z.B. ICE)
339
+ RAIL_REPLACEMENT_TRANSPORT = 17 # Schienenersatzverkehr
340
+ SHUTTLE_TRAIN = 18 # Schuttlezug
341
+ CITIZEN_BUS = 19 # Bürgerbus
342
+ ```
343
+
344
+ ## LineRequestType
345
+ ```python
346
+ class LineRequestType(IntEnum):
347
+ NONE = 0
348
+ DEPARTURE_MONITOR = 1
349
+ STOP_TIMETABLE = 2
350
+ TIMETABLE = 4
351
+ ROUTE_MAPS = 8
352
+ STATION_TIMETABLE = 16
336
353
  ```
337
354
 
338
355
  ## CoordFormat
@@ -2,6 +2,7 @@ from apyefa.client import EfaClient
2
2
  from apyefa.data_classes import (
3
3
  Departure,
4
4
  Line,
5
+ LineRequestType,
5
6
  Location,
6
7
  LocationFilter,
7
8
  LocationType,
@@ -12,6 +13,7 @@ from apyefa.data_classes import (
12
13
  __all__ = [
13
14
  "LocationFilter",
14
15
  "Location",
16
+ "LineRequestType",
15
17
  "LocationType",
16
18
  "Departure",
17
19
  "SystemInfo",
@@ -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,
@@ -79,14 +79,13 @@ class EfaClient:
79
79
  _LOGGER.debug(f"limit: {limit}")
80
80
 
81
81
  command = CommandStopFinder("any", name)
82
- command.add_param("anyMaxSizeHitList", limit)
83
82
 
84
83
  if filters:
85
84
  command.add_param("anyObjFilter_sf", sum(filters))
86
85
 
87
86
  response = await self._run_query(self._build_url(command))
88
87
 
89
- return command.parse(response)
88
+ return command.parse(response)[:limit]
90
89
 
91
90
  async def location_by_coord(
92
91
  self,
@@ -113,11 +112,10 @@ class EfaClient:
113
112
  _LOGGER.debug(f"limit: {limit}")
114
113
 
115
114
  command = CommandStopFinder("coord", f"{coord_x}:{coord_y}:{format}")
116
- command.add_param("anyMaxSizeHitList", limit)
117
115
 
118
116
  response = await self._run_query(self._build_url(command))
119
117
 
120
- return command.parse(response)
118
+ return command.parse(response)[:limit]
121
119
 
122
120
  async def trip(self):
123
121
  raise NotImplementedError
@@ -163,20 +161,24 @@ class EfaClient:
163
161
 
164
162
  return command.parse(response)
165
163
 
166
- async def lines_by_location(self, location: str | Location) -> list[Line]:
164
+ async def lines_by_location(
165
+ self, location: str | Location, req_types: list[LineRequestType] = []
166
+ ) -> list[Line]:
167
167
  """Search for lines that pass `location`. Location can be location ID like `de:08111:6221` or a `Location` object
168
168
 
169
169
  Args:
170
170
  location (str | Location): Location
171
+ req_types (list[LineRequestType], optional): List of types for the request. Defaults to empty.
171
172
 
172
173
  Raises:
173
- ValueError: If not a stop location provided but e.g. POI or Address
174
+ ValueError: Wrong location type provided e.g. LocationType.POI or LocationType.ADDRESS
174
175
 
175
176
  Returns:
176
177
  list[Transport]: List of lines
177
178
  """
178
179
  _LOGGER.info("Request lines by location")
179
180
  _LOGGER.debug(f"location:{location}")
181
+ _LOGGER.debug(f"filters :{req_types}")
180
182
 
181
183
  if isinstance(location, Location):
182
184
  if location.loc_type != LocationType.STOP:
@@ -187,6 +189,9 @@ class EfaClient:
187
189
 
188
190
  command = CommandServingLines("odv", location)
189
191
 
192
+ if req_types:
193
+ command.add_param("lineReqType", sum(req_types))
194
+
190
195
  response = await self._run_query(self._build_url(command))
191
196
 
192
197
  return command.parse(response)
@@ -194,15 +199,6 @@ class EfaClient:
194
199
  async def locations_by_line(self, line: str | Line) -> list[Location]:
195
200
  raise NotImplementedError
196
201
 
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
202
  async def _run_query(self, query: str) -> str:
207
203
  _LOGGER.info(f"Run query {query}")
208
204
 
@@ -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",
@@ -7,6 +7,8 @@ from apyefa.commands.parsers.rapid_json_parser import RapidJsonParser
7
7
  from apyefa.exceptions import EfaFormatNotSupported, EfaParameterError
8
8
  from apyefa.helpers import is_date, is_datetime, is_time
9
9
 
10
+ from ..data_classes import CoordFormat
11
+
10
12
  _LOGGER = logging.getLogger(__name__)
11
13
 
12
14
 
@@ -18,7 +20,7 @@ class Command:
18
20
  self._format: str = output_format
19
21
 
20
22
  self.add_param("outputFormat", output_format)
21
- self.add_param("coordOutputFormat", "WGS84")
23
+ self.add_param("coordOutputFormat", CoordFormat.WGS84.value)
22
24
 
23
25
  def add_param(self, param: str, value: str):
24
26
  if not param or not value:
@@ -3,7 +3,7 @@ import logging
3
3
  from voluptuous import Any, Date, Datetime, Optional, Required, Schema
4
4
 
5
5
  from apyefa.commands.command import Command
6
- from apyefa.data_classes import Departure
6
+ from apyefa.data_classes import CoordFormat, Departure
7
7
 
8
8
  _LOGGER = logging.getLogger(__name__)
9
9
 
@@ -32,7 +32,9 @@ class CommandDepartures(Command):
32
32
  return Schema(
33
33
  {
34
34
  Required("outputFormat", default="rapidJSON"): Any("rapidJSON"),
35
- Required("coordOutputFormat", default="WGS84"): Any("WGS84"),
35
+ Required("coordOutputFormat", default="WGS84"): Any(
36
+ *[x.value for x in CoordFormat]
37
+ ),
36
38
  Required("name_dm"): str,
37
39
  Required("type_dm", default="stop"): Any("any", "stop"),
38
40
  Required("mode", default="direct"): Any("any", "direct"),
@@ -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 CoordFormat, Line, LineRequestType
7
7
 
8
8
  _LOGGER = logging.getLogger(__name__)
9
9
 
@@ -41,14 +41,18 @@ class CommandServingLines(Command):
41
41
  return Schema(
42
42
  {
43
43
  Required("outputFormat", default="rapidJSON"): Any("rapidJSON"),
44
- Required("coordOutputFormat", default="WGS84"): Any("WGS84"),
44
+ Required("coordOutputFormat", default="WGS84"): Any(
45
+ *[x.value for x in CoordFormat]
46
+ ),
45
47
  Required("mode", default="line"): Any("odv", "line"),
46
48
  # mode 'odv'
47
49
  Optional("type_sl"): Any("stopID"),
48
50
  Optional("name_sl"): str,
49
51
  # mode 'line'
50
52
  Optional("lineName"): str,
51
- Optional("lineReqType"): list[0, 2, 4, 8, 16],
53
+ Optional("lineReqType"): Range(
54
+ min=0, max=sum([x.value for x in LineRequestType])
55
+ ),
52
56
  Optional("mergeDir"): Any("0", "1", 0, 1),
53
57
  Optional("lsShowTrainsExplicit"): Any("0", "1", 0, 1),
54
58
  Optional("line"): str,
@@ -3,7 +3,7 @@ import logging
3
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 Location, LocationFilter
6
+ from apyefa.data_classes import CoordFormat, Location, LocationFilter
7
7
 
8
8
  _LOGGER = logging.getLogger(__name__)
9
9
 
@@ -33,7 +33,9 @@ class CommandStopFinder(Command):
33
33
  return Schema(
34
34
  {
35
35
  Required("outputFormat", default="rapidJSON"): Any("rapidJSON"),
36
- Required("coordOutputFormat", default="WGS84"): Any("WGS84"),
36
+ Required("coordOutputFormat", default="WGS84"): Any(
37
+ *[x.value for x in CoordFormat]
38
+ ),
37
39
  Required("type_sf", default="any"): Any("any", "coord"),
38
40
  Required("name_sf"): str,
39
41
  Optional("anyMaxSizeHitList"): int,
@@ -3,7 +3,7 @@ import logging
3
3
  from voluptuous import Any, Optional, Required, Schema
4
4
 
5
5
  from apyefa.commands.command import Command
6
- from apyefa.data_classes import SystemInfo
6
+ from apyefa.data_classes import CoordFormat, SystemInfo
7
7
 
8
8
  _LOGGER = logging.getLogger(__name__)
9
9
 
@@ -23,6 +23,8 @@ class CommandSystemInfo(Command):
23
23
  return Schema(
24
24
  {
25
25
  Required("outputFormat", default="rapidJSON"): Any("rapidJSON"),
26
- Optional("coordOutputFormat", default="WGS84"): Any("WGS84"),
26
+ Optional("coordOutputFormat", default="WGS84"): Any(
27
+ *[x.value for x in CoordFormat]
28
+ ),
27
29
  }
28
30
  )
@@ -4,6 +4,8 @@ from voluptuous import Any, Optional, Required, Schema
4
4
 
5
5
  from apyefa.commands.command import Command
6
6
 
7
+ from ..data_classes import CoordFormat
8
+
7
9
  _LOGGER = logging.getLogger(__name__)
8
10
 
9
11
 
@@ -18,7 +20,9 @@ class CommandTrip(Command):
18
20
  return Schema(
19
21
  {
20
22
  Required("outputFormat", default="rapidJSON"): Any("rapidJSON"),
21
- Required("coordOutputFormat", default="WGS84"): Any("WGS84"),
23
+ Required("coordOutputFormat", default="WGS84"): Any(
24
+ *[x.value for x in CoordFormat]
25
+ ),
22
26
  Required("type_origin", default="any"): Any("any", "coord"),
23
27
  Required("name_origin"): str,
24
28
  Required("type_destination", default="any"): Any("any", "coord"),
@@ -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.6
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
@@ -185,16 +185,14 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
185
185
  ```
186
186
 
187
187
  ## locations_by_coord()
188
- Find localities by coordinates.
189
-
190
- > :x: Currently test endpoint does not sent any answers for this request
188
+ Find localities by their coordinates.
191
189
 
192
190
  ### Arguments
193
191
  |Arguments|Type |Required|Description|
194
192
  |---------|--------------------|--------|-----------|
195
193
  |coord_x |float |required|X-coordinate|
196
194
  |coord_y |float |required|Y-coordinate|
197
- |format |[CoordFormat](#coordformat)|optional|Coordinates format used for request|
195
+ |format |[CoordFormat](#coordformat)|optional|Coordinates format used for request. Default to WGS84.|
198
196
  |limit |int |optional|Max size of returned list. Default value is `10`|
199
197
 
200
198
  ### Return value
@@ -280,14 +278,13 @@ Find lines pass provided location.
280
278
  |Arguments|Type |Required|Description|
281
279
  |---------|--------------------|--------|-----------|
282
280
  |location |str \| [Location](#location) |required|The location passed by searched line(s)|
281
+ |req_types|list[[LineRequestType](#lineRequestType)]|optional|The result presentation type(s) can be defined with this argument. Default value is `[]`
283
282
 
284
283
  ### Return value
285
284
  |Type|Description|
286
285
  |----|-----------|
287
286
  |list[[Line](#line)]|List of lines found for provided location|
288
287
 
289
- > The attribute `origin` of returned `line` objects is None
290
-
291
288
  ### Examples
292
289
  ``` python
293
290
  async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
@@ -367,17 +364,37 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
367
364
  ## TransportType
368
365
  ```python
369
366
  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
367
+ TRAIN = 0 # Zug
368
+ SUBURBAN = 1 # S-Bahn
369
+ SUBWAY = 2 # U-Bahn
370
+ CITY_RAIL = 3 # Stadtbahn
371
+ TRAM = 4 # Straßenbahn
372
+ CITY_BUS = 5 # Stadtbus
373
+ REGIONAL_BUS = 6 # Regionalbus
374
+ EXPRESS_BUS = 7 # Schnellbus
375
+ CABLE_RAIL = 8 # Seilbahn
376
+ FERRY = 9 # Schief
377
+ AST = 10 # Anruf-Sammel-Taxi
378
+ SUSPENSION_RAIL = 11 # Schwebebahn
379
+ AIRPLANE = 12 # Flugzeug
380
+ REGIONAL_TRAIN = 13 # Reginalzug (z.B. IRE, RE und RB)
381
+ NATIONAL_TRAIN = 14 # Nationaler Zug (z.B. IR und D)
382
+ INTERNATINAL_TRAIN = 15 # Internationaler Zug (z.B. IC und EC)
383
+ HIGH_SPEED_TRAIN = 16 # Hochgeschwindigkeitzüge (z.B. ICE)
384
+ RAIL_REPLACEMENT_TRANSPORT = 17 # Schienenersatzverkehr
385
+ SHUTTLE_TRAIN = 18 # Schuttlezug
386
+ CITIZEN_BUS = 19 # Bürgerbus
387
+ ```
388
+
389
+ ## LineRequestType
390
+ ```python
391
+ class LineRequestType(IntEnum):
392
+ NONE = 0
393
+ DEPARTURE_MONITOR = 1
394
+ STOP_TIMETABLE = 2
395
+ TIMETABLE = 4
396
+ ROUTE_MAPS = 8
397
+ STATION_TIMETABLE = 16
381
398
  ```
382
399
 
383
400
  ## CoordFormat
@@ -3,7 +3,11 @@ LICENSE
3
3
  README.md
4
4
  examples.py
5
5
  pyproject.toml
6
+ .github/labeler.yml
7
+ .github/release-drafter.yml
8
+ .github/workflows/labeler.yml
6
9
  .github/workflows/python-package.yml
10
+ .github/workflows/release_drafter.yml
7
11
  .vscode/settings.json
8
12
  apyefa/__init__.py
9
13
  apyefa/client.py
@@ -17,7 +21,6 @@ apyefa.egg-info/requires.txt
17
21
  apyefa.egg-info/top_level.txt
18
22
  apyefa/commands/__init__.py
19
23
  apyefa/commands/command.py
20
- apyefa/commands/command_add_info.py
21
24
  apyefa/commands/command_departures.py
22
25
  apyefa/commands/command_serving_lines.py
23
26
  apyefa/commands/command_stop_finder.py
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "apyefa"
10
- version = "0.0.4"
10
+ version = "0.0.6"
11
11
  requires-python = ">= 3.11"
12
12
  description = "Python API for EFA(Elektronische Fahrplanauskunft) async requests"
13
13
  authors = [
@@ -37,6 +37,7 @@ tests = [
37
37
  minversion = "6.0"
38
38
  asyncio_mode="auto"
39
39
  addopts = "-ra -q"
40
+ asyncio_default_fixture_loop_scope = "function"
40
41
  testpaths = [
41
42
  "tests"
42
43
  ]
@@ -48,7 +48,7 @@ def test_command_init(mock_command):
48
48
  def test_command_to_str_default_params(mock_command):
49
49
  assert (
50
50
  str(mock_command)
51
- == "my_name?commonMacro=my_macro&outputFormat=rapidJSON&coordOutputFormat=WGS84"
51
+ == "my_name?commonMacro=my_macro&outputFormat=rapidJSON&coordOutputFormat=WGS84[dd.ddddd]"
52
52
  )
53
53
 
54
54
 
@@ -12,7 +12,7 @@ STOP_ID_PLAERRER: Final = "de:09564:704"
12
12
 
13
13
  @pytest.fixture(scope="module")
14
14
  def query_url():
15
- return f"https://efa.vgn.de/vgnExt_oeffi/{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&name_dm={STOP_ID_PLAERRER}&itdTime=2216&itdDate=20241110&mode=direct&type_dm=stop"
15
+ return f"https://efa.vgn.de/vgnExt_oeffi/{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&name_dm={STOP_ID_PLAERRER}&mode=direct&type_dm=stop"
16
16
 
17
17
 
18
18
  @pytest.fixture
@@ -28,7 +28,7 @@ def test_init_name_and_macro(command):
28
28
  def test_init_params(command):
29
29
  expected_params = {
30
30
  "outputFormat": "rapidJSON",
31
- "coordOutputFormat": "WGS84",
31
+ "coordOutputFormat": "WGS84[dd.ddddd]",
32
32
  "name_dm": "my_stop",
33
33
  }
34
34
 
@@ -29,7 +29,7 @@ def test_init_params_mode_odv():
29
29
 
30
30
  expected_params = {
31
31
  "outputFormat": "rapidJSON",
32
- "coordOutputFormat": "WGS84",
32
+ "coordOutputFormat": "WGS84[dd.ddddd]",
33
33
  "mode": "odv",
34
34
  "name_sl": "my_value",
35
35
  "type_sl": "stopID",
@@ -43,7 +43,7 @@ def test_init_params_mode_line():
43
43
 
44
44
  expected_params = {
45
45
  "outputFormat": "rapidJSON",
46
- "coordOutputFormat": "WGS84",
46
+ "coordOutputFormat": "WGS84[dd.ddddd]",
47
47
  "mode": "line",
48
48
  "lineName": "my_value",
49
49
  }
@@ -89,6 +89,6 @@ def test_add_param_failed(command, param, value):
89
89
 
90
90
  # test 'to_str() and __str()__'
91
91
  def test_to_str(command):
92
- expected_str = f"{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&coordOutputFormat=WGS84&type_sl=stopID&name_sl=my_name&mode=odv"
92
+ expected_str = f"{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&coordOutputFormat=WGS84[dd.ddddd]&type_sl=stopID&name_sl=my_name&mode=odv"
93
93
 
94
94
  assert command.to_str() == expected_str and str(command) == expected_str
@@ -24,7 +24,7 @@ def test_init_name_and_macro(command):
24
24
  def test_init_params(command):
25
25
  expected_params = {
26
26
  "outputFormat": "rapidJSON",
27
- "coordOutputFormat": "WGS84",
27
+ "coordOutputFormat": "WGS84[dd.ddddd]",
28
28
  "type_sf": "any",
29
29
  "name_sf": "my_name",
30
30
  }
@@ -49,7 +49,7 @@ def test_add_param_failed(command, param, value):
49
49
 
50
50
  # test 'to_str() and __str()__'
51
51
  def test_to_str(command):
52
- expected_str = f"{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&coordOutputFormat=WGS84&type_sf=any&name_sf=my_name"
52
+ expected_str = f"{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&coordOutputFormat=WGS84[dd.ddddd]&type_sf=any&name_sf=my_name"
53
53
 
54
54
  assert command.to_str() == expected_str and str(command) == expected_str
55
55
 
@@ -23,7 +23,10 @@ def test_init_name_and_macro(command):
23
23
 
24
24
 
25
25
  def test_init_parameters(command):
26
- expected_params = {"outputFormat": "rapidJSON", "coordOutputFormat": "WGS84"}
26
+ expected_params = {
27
+ "outputFormat": "rapidJSON",
28
+ "coordOutputFormat": "WGS84[dd.ddddd]",
29
+ }
27
30
 
28
31
  assert command._parameters == expected_params
29
32
 
@@ -45,9 +48,7 @@ def test_add_param_failed(command, param, value):
45
48
 
46
49
  # test 'to_str() and __str()__'
47
50
  def test_to_str(command):
48
- expected_str = (
49
- f"{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&coordOutputFormat=WGS84"
50
- )
51
+ expected_str = f"{NAME}?commonMacro={MACRO}&outputFormat=rapidJSON&coordOutputFormat=WGS84[dd.ddddd]"
51
52
 
52
53
  assert command.to_str() == expected_str and str(command) == expected_str
53
54
 
@@ -53,17 +53,20 @@ def test_init_macro_and_name(command, cmd_name, cmd_macro, request):
53
53
  [
54
54
  (
55
55
  "system_info_command",
56
- {"outputFormat": "rapidJSON", "coordOutputFormat": "WGS84"},
56
+ {"outputFormat": "rapidJSON", "coordOutputFormat": "WGS84[dd.ddddd]"},
57
57
  ),
58
58
  (
59
59
  "departures_command",
60
60
  {
61
61
  "outputFormat": "rapidJSON",
62
- "coordOutputFormat": "WGS84",
62
+ "coordOutputFormat": "WGS84[dd.ddddd]",
63
63
  "name_dm": "my_stop",
64
64
  },
65
65
  ),
66
- ("trip_command", {"outputFormat": "rapidJSON", "coordOutputFormat": "WGS84"}),
66
+ (
67
+ "trip_command",
68
+ {"outputFormat": "rapidJSON", "coordOutputFormat": "WGS84[dd.ddddd]"},
69
+ ),
67
70
  ],
68
71
  )
69
72
  def test_init_parameters(command, expected, request):
@@ -79,7 +82,7 @@ def test_init_parameters_serving_lines():
79
82
  cmd = CommandServingLines("line", "my_value")
80
83
  assert cmd._parameters == {
81
84
  "outputFormat": "rapidJSON",
82
- "coordOutputFormat": "WGS84",
85
+ "coordOutputFormat": "WGS84[dd.ddddd]",
83
86
  "lineName": "my_value",
84
87
  "mode": "line",
85
88
  }
@@ -87,7 +90,7 @@ def test_init_parameters_serving_lines():
87
90
  cmd = CommandServingLines("odv", "my_value")
88
91
  assert cmd._parameters == {
89
92
  "outputFormat": "rapidJSON",
90
- "coordOutputFormat": "WGS84",
93
+ "coordOutputFormat": "WGS84[dd.ddddd]",
91
94
  "type_sl": "stopID",
92
95
  "name_sl": "my_value",
93
96
  "mode": "odv",
@@ -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
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