apyefa 0.0.3__tar.gz → 0.0.5__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.
- apyefa-0.0.5/.github/labeler.yml +14 -0
- apyefa-0.0.5/.github/release-drafter.yml +29 -0
- apyefa-0.0.5/.github/workflows/labeler.yml +13 -0
- apyefa-0.0.5/.github/workflows/release_drafter.yml +15 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/PKG-INFO +34 -15
- {apyefa-0.0.3 → apyefa-0.0.5}/README.md +32 -13
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/client.py +11 -3
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/command_serving_lines.py +5 -3
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/data_classes.py +51 -9
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa.egg-info/PKG-INFO +34 -15
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa.egg-info/SOURCES.txt +4 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/examples.py +7 -4
- {apyefa-0.0.3 → apyefa-0.0.5}/pyproject.toml +3 -2
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/test_cmd_departures.py +1 -1
- {apyefa-0.0.3 → apyefa-0.0.5}/.github/workflows/python-package.yml +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/.gitignore +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/.vscode/settings.json +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/LICENSE +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/__init__.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/__init__.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/command.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/command_departures.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/command_stop_finder.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/command_system_info.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/command_trip.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/parsers/__init__.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/parsers/parser.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/parsers/rapid_json_parser.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/commands/parsers/xml_parser.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/exceptions.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa/helpers.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa.egg-info/dependency_links.txt +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa.egg-info/requires.txt +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/apyefa.egg-info/top_level.txt +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/setup.cfg +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/__init__.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/parsers/__init__.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/parsers/test_json_parser.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/parsers/test_xml_parser.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/test_cmd.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/test_cmd_serving_lines.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/test_cmd_stop_finder.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/test_cmd_system_info.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/commands/test_commands.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/conftest.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/data_classes/__init__.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/data_classes/test_departure.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/data_classes/test_location.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/data_classes/test_system_info.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/data_classes/test_transportation.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/tests/test_client.py +0 -0
- {apyefa-0.0.3 → apyefa-0.0.5}/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,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.
|
|
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,
|
|
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
|
-
|
|
371
|
-
SUBURBAN
|
|
372
|
-
SUBWAY
|
|
373
|
-
CITY_RAIL
|
|
374
|
-
TRAM
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
EXPRESS_BUS
|
|
378
|
-
|
|
379
|
-
FERRY
|
|
380
|
-
AST
|
|
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
|
|
@@ -235,14 +235,13 @@ Find lines pass provided location.
|
|
|
235
235
|
|Arguments|Type |Required|Description|
|
|
236
236
|
|---------|--------------------|--------|-----------|
|
|
237
237
|
|location |str \| [Location](#location) |required|The location passed by searched line(s)|
|
|
238
|
+
|req_types|list[[LineRequestType](#lineRequestType)]|optional|The result presentation type(s) can be defined with this argument. Default value is `[]`
|
|
238
239
|
|
|
239
240
|
### Return value
|
|
240
241
|
|Type|Description|
|
|
241
242
|
|----|-----------|
|
|
242
243
|
|list[[Line](#line)]|List of lines found for provided location|
|
|
243
244
|
|
|
244
|
-
> The attribute `origin` of returned `line` objects is None
|
|
245
|
-
|
|
246
245
|
### Examples
|
|
247
246
|
``` python
|
|
248
247
|
async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
|
|
@@ -322,17 +321,37 @@ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
|
|
|
322
321
|
## TransportType
|
|
323
322
|
```python
|
|
324
323
|
class TransportType(IntEnum):
|
|
325
|
-
|
|
326
|
-
SUBURBAN
|
|
327
|
-
SUBWAY
|
|
328
|
-
CITY_RAIL
|
|
329
|
-
TRAM
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
EXPRESS_BUS
|
|
333
|
-
|
|
334
|
-
FERRY
|
|
335
|
-
AST
|
|
324
|
+
TRAIN = 0 # Zug
|
|
325
|
+
SUBURBAN = 1 # S-Bahn
|
|
326
|
+
SUBWAY = 2 # U-Bahn
|
|
327
|
+
CITY_RAIL = 3 # Stadtbahn
|
|
328
|
+
TRAM = 4 # Straßenbahn
|
|
329
|
+
CITY_BUS = 5 # Stadtbus
|
|
330
|
+
REGIONAL_BUS = 6 # Regionalbus
|
|
331
|
+
EXPRESS_BUS = 7 # Schnellbus
|
|
332
|
+
CABLE_RAIL = 8 # Seilbahn
|
|
333
|
+
FERRY = 9 # Schief
|
|
334
|
+
AST = 10 # Anruf-Sammel-Taxi
|
|
335
|
+
SUSPENSION_RAIL = 11 # Schwebebahn
|
|
336
|
+
AIRPLANE = 12 # Flugzeug
|
|
337
|
+
REGIONAL_TRAIN = 13 # Reginalzug (z.B. IRE, RE und RB)
|
|
338
|
+
NATIONAL_TRAIN = 14 # Nationaler Zug (z.B. IR und D)
|
|
339
|
+
INTERNATINAL_TRAIN = 15 # Internationaler Zug (z.B. IC und EC)
|
|
340
|
+
HIGH_SPEED_TRAIN = 16 # Hochgeschwindigkeitzüge (z.B. ICE)
|
|
341
|
+
RAIL_REPLACEMENT_TRANSPORT = 17 # Schienenersatzverkehr
|
|
342
|
+
SHUTTLE_TRAIN = 18 # Schuttlezug
|
|
343
|
+
CITIZEN_BUS = 19 # Bürgerbus
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## LineRequestType
|
|
347
|
+
```python
|
|
348
|
+
class LineRequestType(IntEnum):
|
|
349
|
+
NONE = 0
|
|
350
|
+
DEPARTURE_MONITOR = 1
|
|
351
|
+
STOP_TIMETABLE = 2
|
|
352
|
+
TIMETABLE = 4
|
|
353
|
+
ROUTE_MAPS = 8
|
|
354
|
+
STATION_TIMETABLE = 16
|
|
336
355
|
```
|
|
337
356
|
|
|
338
357
|
## CoordFormat
|
|
@@ -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(
|
|
166
|
-
|
|
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:
|
|
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"):
|
|
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,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
31
|
-
|
|
51
|
+
CITY_BUS = 5 # Stadtbus
|
|
52
|
+
REGIONAL_BUS = 6 # Regionalbus
|
|
32
53
|
EXPRESS_BUS = 7 # Schnellbus
|
|
33
|
-
|
|
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
|
+
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,
|
|
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
|
-
|
|
371
|
-
SUBURBAN
|
|
372
|
-
SUBWAY
|
|
373
|
-
CITY_RAIL
|
|
374
|
-
TRAM
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
EXPRESS_BUS
|
|
378
|
-
|
|
379
|
-
FERRY
|
|
380
|
-
AST
|
|
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
|
|
@@ -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
|
|
@@ -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.
|
|
11
|
-
client.
|
|
12
|
-
client.
|
|
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.
|
|
10
|
+
version = "0.0.5"
|
|
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", "
|
|
18
|
+
keywords = ["efa", "public transport", "traffic"]
|
|
19
19
|
|
|
20
20
|
dependencies = [
|
|
21
21
|
"aiohttp>=3.11.7",
|
|
@@ -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
|
]
|
|
@@ -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}&
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|