apyefa 0.0.1__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 (48) hide show
  1. apyefa-0.0.1/.github/workflows/python-package.yml +58 -0
  2. apyefa-0.0.1/.gitignore +162 -0
  3. apyefa-0.0.1/.vscode/settings.json +17 -0
  4. apyefa-0.0.1/LICENSE +21 -0
  5. apyefa-0.0.1/PKG-INFO +413 -0
  6. apyefa-0.0.1/README.md +368 -0
  7. apyefa-0.0.1/apyefa/__init__.py +21 -0
  8. apyefa-0.0.1/apyefa/client.py +215 -0
  9. apyefa-0.0.1/apyefa/commands/__init__.py +15 -0
  10. apyefa-0.0.1/apyefa/commands/command.py +115 -0
  11. apyefa-0.0.1/apyefa/commands/command_departures.py +49 -0
  12. apyefa-0.0.1/apyefa/commands/command_serving_lines.py +60 -0
  13. apyefa-0.0.1/apyefa/commands/command_stop_finder.py +48 -0
  14. apyefa-0.0.1/apyefa/commands/command_system_info.py +28 -0
  15. apyefa-0.0.1/apyefa/commands/command_trip.py +31 -0
  16. apyefa-0.0.1/apyefa/commands/parsers/__init__.py +0 -0
  17. apyefa-0.0.1/apyefa/commands/parsers/parser.py +7 -0
  18. apyefa-0.0.1/apyefa/commands/parsers/rapid_json_parser.py +11 -0
  19. apyefa-0.0.1/apyefa/commands/parsers/xml_parser.py +6 -0
  20. apyefa-0.0.1/apyefa/data_classes.py +381 -0
  21. apyefa-0.0.1/apyefa/exceptions.py +18 -0
  22. apyefa-0.0.1/apyefa/helpers.py +74 -0
  23. apyefa-0.0.1/apyefa.egg-info/PKG-INFO +413 -0
  24. apyefa-0.0.1/apyefa.egg-info/SOURCES.txt +46 -0
  25. apyefa-0.0.1/apyefa.egg-info/dependency_links.txt +1 -0
  26. apyefa-0.0.1/apyefa.egg-info/requires.txt +11 -0
  27. apyefa-0.0.1/apyefa.egg-info/top_level.txt +1 -0
  28. apyefa-0.0.1/examples.py +29 -0
  29. apyefa-0.0.1/pyproject.toml +63 -0
  30. apyefa-0.0.1/setup.cfg +4 -0
  31. apyefa-0.0.1/tests/commands/__init__.py +0 -0
  32. apyefa-0.0.1/tests/commands/parsers/__init__.py +0 -0
  33. apyefa-0.0.1/tests/commands/parsers/test_json_parser.py +19 -0
  34. apyefa-0.0.1/tests/commands/parsers/test_xml_parser.py +13 -0
  35. apyefa-0.0.1/tests/commands/test_cmd.py +155 -0
  36. apyefa-0.0.1/tests/commands/test_cmd_departures.py +60 -0
  37. apyefa-0.0.1/tests/commands/test_cmd_serving_lines.py +94 -0
  38. apyefa-0.0.1/tests/commands/test_cmd_stop_finder.py +87 -0
  39. apyefa-0.0.1/tests/commands/test_cmd_system_info.py +72 -0
  40. apyefa-0.0.1/tests/commands/test_commands.py +98 -0
  41. apyefa-0.0.1/tests/conftest.py +7 -0
  42. apyefa-0.0.1/tests/data_classes/__init__.py +0 -0
  43. apyefa-0.0.1/tests/data_classes/test_departure.py +0 -0
  44. apyefa-0.0.1/tests/data_classes/test_location.py +0 -0
  45. apyefa-0.0.1/tests/data_classes/test_system_info.py +49 -0
  46. apyefa-0.0.1/tests/data_classes/test_transportation.py +0 -0
  47. apyefa-0.0.1/tests/test_client.py +17 -0
  48. apyefa-0.0.1/tests/test_helpers.py +15 -0
@@ -0,0 +1,58 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3
+
4
+ name: Python package
5
+
6
+ on:
7
+ push:
8
+ branches: [ "master", "dev" ]
9
+ pull_request:
10
+ branches: [ "master" ]
11
+
12
+ permissions:
13
+ checks: write
14
+ pull-requests: write
15
+
16
+ jobs:
17
+ build:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ python-version: ["3.11", "3.12", "3.13"]
24
+
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Display Python version
32
+ run: python -c "import sys; print(sys.version)"
33
+ - name: Install dependencies
34
+ run: |
35
+ python -m pip install --upgrade pip setuptools wheel
36
+ python -m pip install .[tests]
37
+ - name: Install the code linting and formatting tool Ruff
38
+ run: pipx install ruff
39
+ - name: Lint code with Ruff
40
+ run: ruff check --output-format=github --target-version=py39
41
+ - name: Check code formatting with Ruff
42
+ run: ruff format --diff --target-version=py39
43
+ continue-on-error: true
44
+ - name: Test with pytest
45
+ run: |
46
+ pytest --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml
47
+ - name: Upload pytest test results
48
+ uses: actions/upload-artifact@v4
49
+ with:
50
+ name: pytest-results-${{ matrix.python-version }}
51
+ path: junit/test-results-${{ matrix.python-version }}.xml
52
+ if: ${{ always() }}
53
+ - name: Publish Test Results
54
+ uses: EnricoMi/publish-unit-test-result-action@v2
55
+ if: always()
56
+ with:
57
+ files: |
58
+ junit/**/*.xml
@@ -0,0 +1,162 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
@@ -0,0 +1,17 @@
1
+ {
2
+ "python.testing.pytestArgs": [
3
+ "tests"
4
+ ],
5
+ "python.testing.unittestEnabled": false,
6
+ "python.testing.pytestEnabled": true,
7
+ "editor.codeActionsOnSave":
8
+ {
9
+ "source.organizeImports": "always",
10
+ },
11
+ "editor.defaultFormatter": "ms-python.black-formatter",
12
+ "notebook.defaultFormatter": "ms-python.black-formatter",
13
+ "editor.formatOnSave": true,
14
+ "[json]": {
15
+ "editor.defaultFormatter": "vscode.json-language-features"
16
+ }
17
+ }
apyefa-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Alex Jung
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
apyefa-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,413 @@
1
+ Metadata-Version: 2.1
2
+ Name: apyefa
3
+ Version: 0.0.1
4
+ Summary: Python API for EFA(Elektronische Fahrplanauskunft) async requests
5
+ Author-email: Alex Jung <jungdevelop@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Alex Jung
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/alex-jung/apyefa
28
+ Project-URL: Documentation, https://github.com/alex-jung/apyefa
29
+ Project-URL: Repository, https://github.com/alex-jung/apyefa
30
+ Project-URL: Issues, https://github.com/alex-jung/apyefa/issues
31
+ Keywords: efa,vgn,gtfs,public transport,traffic
32
+ Requires-Python: >=3.11
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Requires-Dist: aiohttp==3.11.7
36
+ Requires-Dist: voluptuous==0.15.2
37
+ Requires-Dist: tzdata==2024.2
38
+ Provides-Extra: tests
39
+ Requires-Dist: coverage>=5.0.3; extra == "tests"
40
+ Requires-Dist: pytest-cov; extra == "tests"
41
+ Requires-Dist: pytest; extra == "tests"
42
+ Requires-Dist: pytest-asyncio==0.24.0; extra == "tests"
43
+ Requires-Dist: pytest-benchmark[histogram]>=3.2.1; extra == "tests"
44
+ Requires-Dist: requests==2.32.3; extra == "tests"
45
+
46
+ # apyefa
47
+ [![Python package](https://github.com/alex-jung/apyefa/actions/workflows/python-package.yml/badge.svg)](https://github.com/alex-jung/apyefa/actions/workflows/python-package.yml)
48
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
49
+ # Intro
50
+ **apyefa** is a python package used to asynchronously fetch public transit routing data via EFA interfaces like [efa.vgn](https://efa.vgn.de/vgnExt_oeffi/"). It can request itineraries for Bus/Trams/Subways etc. connections and return data in a human and machine readable format.
51
+ # Installation
52
+ You only need to install the **apyefa** package, for example using pip:
53
+ ``` bash
54
+ pip install apyefa
55
+ ```
56
+
57
+ # Restrictions
58
+ Currently the package supports only endpoints using [RapidJSON](https://rapidjson.org/) format. To check whether the endpoint supports this format, please call:
59
+ ``` bash
60
+ To describe(!)
61
+ ```
62
+
63
+ # Development setup
64
+ Create and activate virtual environment. Then install dependencies required by `apefa` package.
65
+ ``` bash
66
+ python3 -m venv .venv
67
+ source .venv/bin/activate
68
+ pip install .
69
+ ```
70
+
71
+ # EfaClient functions
72
+ |Function name |Implementation |Documentation |
73
+ |----------------------------------------------------|------------------|------------------|
74
+ |[info()](#info) |:white_check_mark:|:white_check_mark:|
75
+ |[locations_by_name()](#locations_by_name) |:white_check_mark:|:white_check_mark:|
76
+ |[location_by_coord()](#locations_by_coord) |:white_check_mark:|:white_check_mark:|
77
+ |[trip()](#trip) |:x: |:x: |
78
+ |[departures_by_location()](#departures_by_location) |:white_check_mark:|:white_check_mark:|
79
+ |[lines_by_name()](#lines_by_name) |:white_check_mark:|:white_check_mark:|
80
+ |[lines_by_location()](#lines_by_location) |:white_check_mark:|:white_check_mark:|
81
+ |[locations_by_line()](#locations_by_line) |:x: |:x: |
82
+ |[coords()](#coords) |:x: |:x: |
83
+ |[geo_object()](#geo_object) |:x: |:x: |
84
+ |[trip_stop_time()](#trip_stop_time) |:x: |:x: |
85
+ |[stop_seq_coord()](#stop_seq_coord) |:x: |:x: |
86
+ |[map_route()](#map_route) |:x: |:x: |
87
+ |[add_info()](#add_info) |:x: |:x: |
88
+ |[stop_list()](#stop_list) |:x: |:x: |
89
+ |[line_list()](#line_list) |:x: |:x: |
90
+
91
+ ## info()
92
+ Provides end API system information.
93
+
94
+ ### Arguments
95
+ None
96
+
97
+ ### Return value
98
+ |Type|Description|
99
+ |----|-----------|
100
+ |[SystemInfo](#systeminfo)|System information object|
101
+
102
+ ### Example request
103
+ ``` python
104
+ from apyefa import EfaClient, SystemInfo
105
+ from pprint import pprint
106
+
107
+ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
108
+ info: SystemInfo = await client.info()
109
+
110
+ pprint(info)
111
+
112
+ # OUTPUT:
113
+ # SystemInfo(version='10.6.14.22',
114
+ # app_version='10.4.30.6 build 16.09.2024 01:30:57',
115
+ # data_format='EFA10_04_00',
116
+ # data_build='2024-12-02T16:53:02Z',
117
+ # valid_from=datetime.date(2024, 11, 1),
118
+ # valid_to=datetime.date(2025, 12, 13))
119
+ ```
120
+
121
+ ## locations_by_name()
122
+ Find localities by name or unique id.
123
+
124
+ ### Arguments
125
+ |Name |Type |Required|Description|
126
+ |---------|--------------------|--------|-----------|
127
+ |name |str |required|Name or id ID of locality to search for|
128
+ |filters |list[[LocationFilter](#locationfilter)]|optional|The localition search may be limited by certain types of objects using this parameter. Default value is `[]`|
129
+ |limit |int |optional|Max size of returned list. Default value is `30`|
130
+
131
+ ### Return value
132
+ |Type|Description|
133
+ |----|-----------|
134
+ |list[[Location](#location)]|List of locations found py provided name sorted by match quality|
135
+
136
+
137
+ ### Examples
138
+ 1. Search for all localities contain name `Plärrer`
139
+ ``` python
140
+ from apyefa import EfaClient, Location, LocationFilter
141
+
142
+ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
143
+ locations: list[Location] = await client.locations_by_name("Plärrer")
144
+
145
+ print(f"Found {len(locations)} location(s)")
146
+ print(location[0].id)
147
+ print(location[0].name)
148
+ print(location[0].loc_type)
149
+ # OUTPUT:
150
+ # Found 20 location(s)
151
+ # de:09574:7132
152
+ # Hersbruck, Plärrer
153
+ # <LocationType.STOP: 'stop'>
154
+ ```
155
+ 2. Search for POIs and Addresses with name `Plärrer`
156
+ ``` python
157
+ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
158
+ locations: list[Location] = await client.locations_by_name("Plärrer", filters=[LocationFilter.ADDRESSES, LocationFilter.POIS])
159
+
160
+ print(f"Found {len(locations)} location(s)")
161
+ print(location[0].id)
162
+ print(location[0].name)
163
+ print(location[0].loc_type)
164
+
165
+ # OUTPUT:
166
+ # Found 4 location(s)
167
+ # poiID:1000029001:9564000:-1:N-PLärrer:Nürnberg:N-PLärrer:ANY:POI:4431934:680416:NAV4:vgn
168
+ # Nürnberg, N-PLärrer
169
+ # <LocationType.POI: 'poi'>
170
+ ```
171
+ 3. Search by `stop id`
172
+ ``` python
173
+ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
174
+ locations: list[Location] = await client.locations_by_name("de:09564:704")
175
+
176
+ print(f"Found {len(locations)} location(s)")
177
+ print(location[0].id)
178
+ print(location[0].name)
179
+ print(location[0].loc_type)
180
+ # OUTPUT:
181
+ # Found 1 location(s)
182
+ # de:09564:704
183
+ # Nürnberg, N-PLärrer
184
+ # <LocationType.STOP: 'stop'>
185
+ ```
186
+
187
+ ## locations_by_coord()
188
+ Find localities by coordinates.
189
+
190
+ > :x: Currently test endpoint does not sent any answers for this request
191
+
192
+ ### Arguments
193
+ |Arguments|Type |Required|Description|
194
+ |---------|--------------------|--------|-----------|
195
+ |coord_x |float |required|X-coordinate|
196
+ |coord_y |float |required|Y-coordinate|
197
+ |format |[CoordFormat](#coordformat)|optional|Coordinates format used for request|
198
+ |limit |int |optional|Max size of returned list. Default value is `10`|
199
+
200
+ ### Return value
201
+ |Type|Description|
202
+ |----|-----------|
203
+ |list[[Location](#location)]|List of locations found py provided name sorted by match quality|
204
+
205
+ ## trip()
206
+
207
+ ## departures_by_location()
208
+ Find all departures for a specific location
209
+
210
+ ### Arguments
211
+ |Arguments|Type |Required|Description|
212
+ |---------|--------------------|--------|-----------|
213
+ |stop |[Location](#location) \| str |required|Location for which the departures are being sought|
214
+ |limit |int |optional|Max size of returned list. Default value is `40`|
215
+ |date |str |optional|Date/time for which the departures are sought in format "YYYYMMDD hh:mm", "YYYYMMDD" or "mm:hh". Default value is `empty`|
216
+
217
+ ### Return value
218
+ |Type|Description|
219
+ |----|-----------|
220
+ |list[[Departure](#departure)]|List of departures sorted by departure time|
221
+
222
+ ### Examples
223
+ ``` python
224
+ from apyefa import EfaClient, Departure
225
+
226
+ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
227
+ departures: list[Departure] = await client.departures_by_location("de:09564:704", limit=3, date="22:13")
228
+
229
+ print(f"Found {len(departures)} departure(s)")
230
+ print(location[0].line_name)
231
+ print(location[0].route)
232
+ print(location[0].transport)
233
+ print(location[0].planned_time)
234
+ # OUTPUT:
235
+ # Found 3 departure(s)
236
+ # U3
237
+ # Nordwestring - Hauptbahnhof - Plärrer - Großreuth bei Schweinau
238
+ # <TransportType.SUBWAY: 2>
239
+ # datetime.datetime(2024, 12, 7, 22, 16, tzinfo=zoneinfo.ZoneInfo(key='Europe/Berlin'))
240
+ ```
241
+
242
+ ## lines_by_name()
243
+ Find lines by name.
244
+
245
+ ### Arguments
246
+ |Arguments|Type |Required|Description|
247
+ |---------|--------------------|--------|-----------|
248
+ |name |str |required|Name of the line to search. e.g. `U1` or `67`|
249
+
250
+ ### Return value
251
+ |Type|Description|
252
+ |----|-----------|
253
+ |list[[Line](#line)]|List of lines found for provided name|
254
+
255
+ > NOTE: The attribute `origin` of returned `line` objects is None
256
+
257
+ ### Examples
258
+ ``` python
259
+ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
260
+ lines: list[Line] = await client.lines_by_name("U1")
261
+
262
+ print(f"Found {len(lines)} line(s)")
263
+ print(f"id : {lines[0].id}")
264
+ print(f"name : {lines[0].name}")
265
+ print(f"description: {lines[0].description}")
266
+ print(f"product : {lines[0].product}")
267
+
268
+ # OUTPUT:
269
+ # Found 4 line(s)
270
+ # id : vgn:11001: :H:j24
271
+ # name : U1
272
+ # description: Fürth Hardhöhe - Nürnberg Plärrer - Hauptbahnhof - Langwasser Süd
273
+ # product : <TransportType.SUBWAY: 2>
274
+ ```
275
+
276
+ ## lines_by_location()
277
+ Find lines pass provided location.
278
+
279
+ ### Arguments
280
+ |Arguments|Type |Required|Description|
281
+ |---------|--------------------|--------|-----------|
282
+ |location |str \| [Location](#location) |required|The location passed by searched line(s)|
283
+
284
+ ### Return value
285
+ |Type|Description|
286
+ |----|-----------|
287
+ |list[[Line](#line)]|List of lines found for provided location|
288
+
289
+ > The attribute `origin` of returned `line` objects is None
290
+
291
+ ### Examples
292
+ ``` python
293
+ async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
294
+ lines: list[Line] = await client.lines_by_location("de:09564:704")
295
+
296
+ print(f"Found {len(lines)} line(s)")
297
+ print(f"id : {lines[0].id}")
298
+ print(f"name : {lines[0].name}")
299
+ print(f"description: {lines[0].description}")
300
+ print(f"product : {lines[0].product}")
301
+
302
+ # OUTPUT:
303
+ # Found 10 line(s)
304
+ # id : vgn:33283: :H:j24
305
+ # name : 283
306
+ # description: Hugenottenplatz - St. Johann - Dechsendorfer Weiher
307
+ # product : <TransportType.BUS: 5>
308
+ ```
309
+
310
+ ## coords()
311
+ ## geo_object()
312
+ ## trip_stop_time()
313
+ ## stop_seq_coord()
314
+ ## map_route()
315
+ ## add_info()
316
+ ## stop_list()
317
+ ## line_list()
318
+
319
+ # Data Classes
320
+ ## SystemInfo
321
+ |Attribute |Type|Description |
322
+ |------------|----|------------------------ |
323
+ |version |str |API internal information|
324
+ |app_version |str |API internal information |
325
+ |data_format |str |API internal information |
326
+ |data_build |str |API internal information |
327
+ |valid_from |date|Start validity date |
328
+ |valid_to |date|End validity date |
329
+
330
+ ## Location
331
+ |Attribute |Type |Description |
332
+ |-----------------|-------------------|-------------|
333
+ |name |str |Name of location e.g. `Nürnberg, Nordostbahnhof`|
334
+ |loc_type |[LocationType](#locationtype)|Type of location e.g. `STOP` or `POI`|
335
+ |id |str |Location unique id|
336
+ |coord |list[int] |Location coordinates|
337
+ |transports |list[[TransportType](#transporttype)]|Transport type(s) this location pass|
338
+ |parent |[Location](#location) \| None|Parent location|
339
+ |stops |list[[Location](#location)]|Location with type `STOP` assigned to this location|
340
+ |properties |dict |API internal information|
341
+
342
+ ## Departure
343
+ |Attribute |Type|Description |
344
+ |---------------|----|------------------------|
345
+ |location |[Location](#location) |Location of departure|
346
+ |line_name |str |Line name e.g. `U3`|
347
+ |route |str |The complete route name from origin to destination stops e.g. `Nordwestring - Hauptbahnhof - Plärrer - Großreuth bei Schweinau`|
348
+ |origin |[Location](#location)|Origin location|
349
+ |destination |[Location](#location)|Destination location|
350
+ |transport |[TransportType](#transporttype)|Transport type e.g. `Bus` or `Subway`|
351
+ |planned_time |datetime|Planned departure time|
352
+ |estimated_time |datetime \| None|Estimated departure time(will be provided by endpoits supporting real time mode)|
353
+ |infos |list[dict] \| None|List of ICS messages|
354
+
355
+ ## Line
356
+ |Attribute |Type|Description |
357
+ |------------|----|------------------------ |
358
+ |id |str |Line id |
359
+ |name |str |Line name |
360
+ |description |str |Route name |
361
+ |product |[TransportType](#transporttype) |Type of transportation. Bus, Subway etc.|
362
+ |destination |[Location](#location)|Line destination location|
363
+ |origin |[Location](#location) \| None|Line start location|
364
+ |properties |dict|Additional properties |
365
+
366
+ # Enums
367
+ ## TransportType
368
+ ```python
369
+ 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
381
+ ```
382
+
383
+ ## CoordFormat
384
+ ```python
385
+ class CoordFormat(StrEnum):
386
+ WGS84 = "WGS84 [dd.ddddd]"
387
+ ```
388
+
389
+ ## LocationFilter
390
+ ```python
391
+ class LocationFilter(IntEnum):
392
+ NO_FILTER = 0
393
+ LOCATIONS = 1
394
+ STOPS = 2
395
+ STREETS = 4
396
+ ADDRESSES = 8
397
+ INTERSACTIONS = 16
398
+ POIS = 32
399
+ POST_CODES = 64
400
+ ```
401
+
402
+ ## LocationType
403
+ ```python
404
+ class LocationType(StrEnum):
405
+ STOP = "stop"
406
+ POI = "poi"
407
+ ADDRESS = "address"
408
+ STREET = "street"
409
+ LOCALITY = "locality"
410
+ SUBURB = "suburb"
411
+ PLATFORM = "platform"
412
+ UNKNOWN = "unknown"
413
+ ```