apyefa 0.0.6__tar.gz → 1.0.0__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 (74) hide show
  1. {apyefa-0.0.6 → apyefa-1.0.0}/.gitignore +3 -27
  2. apyefa-1.0.0/PKG-INFO +125 -0
  3. apyefa-1.0.0/README.md +80 -0
  4. apyefa-1.0.0/apyefa/client.py +712 -0
  5. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/__init__.py +12 -0
  6. apyefa-1.0.0/apyefa/commands/command.py +161 -0
  7. apyefa-1.0.0/apyefa/commands/command_add_info.py +60 -0
  8. apyefa-1.0.0/apyefa/commands/command_coord.py +45 -0
  9. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/command_departures.py +4 -5
  10. apyefa-1.0.0/apyefa/commands/command_geoobject.py +42 -0
  11. apyefa-1.0.0/apyefa/commands/command_line_list.py +46 -0
  12. apyefa-1.0.0/apyefa/commands/command_line_stop.py +39 -0
  13. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/command_serving_lines.py +8 -18
  14. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/command_stop_finder.py +4 -6
  15. apyefa-1.0.0/apyefa/commands/command_stop_list.py +48 -0
  16. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/command_system_info.py +3 -3
  17. apyefa-1.0.0/apyefa/commands/command_trip.py +56 -0
  18. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/data_classes.py +191 -66
  19. apyefa-1.0.0/apyefa/helpers.py +135 -0
  20. apyefa-1.0.0/apyefa.egg-info/PKG-INFO +125 -0
  21. apyefa-1.0.0/apyefa.egg-info/SOURCES.txt +59 -0
  22. {apyefa-0.0.6 → apyefa-1.0.0}/pyproject.toml +1 -1
  23. apyefa-1.0.0/tests/integration/test_endpoints.py +61 -0
  24. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/commands/test_cmd.py +52 -46
  25. apyefa-1.0.0/tests/unit/commands/test_cmd_departures.py +119 -0
  26. apyefa-1.0.0/tests/unit/commands/test_cmd_line_list.py +94 -0
  27. apyefa-1.0.0/tests/unit/commands/test_cmd_line_stop.py +83 -0
  28. apyefa-1.0.0/tests/unit/commands/test_cmd_serving_lines.py +95 -0
  29. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/commands/test_cmd_stop_finder.py +24 -20
  30. apyefa-1.0.0/tests/unit/commands/test_cmd_stop_list.py +255 -0
  31. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/commands/test_cmd_system_info.py +11 -17
  32. apyefa-1.0.0/tests/unit/test_client.py +578 -0
  33. apyefa-1.0.0/tests/unit/test_helpers.py +52 -0
  34. apyefa-0.0.6/PKG-INFO +0 -430
  35. apyefa-0.0.6/README.md +0 -385
  36. apyefa-0.0.6/apyefa/client.py +0 -221
  37. apyefa-0.0.6/apyefa/commands/command.py +0 -117
  38. apyefa-0.0.6/apyefa/commands/command_trip.py +0 -35
  39. apyefa-0.0.6/apyefa/helpers.py +0 -74
  40. apyefa-0.0.6/apyefa.egg-info/PKG-INFO +0 -430
  41. apyefa-0.0.6/apyefa.egg-info/SOURCES.txt +0 -50
  42. apyefa-0.0.6/tests/commands/test_cmd_departures.py +0 -60
  43. apyefa-0.0.6/tests/commands/test_cmd_serving_lines.py +0 -94
  44. apyefa-0.0.6/tests/commands/test_commands.py +0 -101
  45. apyefa-0.0.6/tests/test_client.py +0 -17
  46. apyefa-0.0.6/tests/test_helpers.py +0 -15
  47. {apyefa-0.0.6 → apyefa-1.0.0}/.github/labeler.yml +0 -0
  48. {apyefa-0.0.6 → apyefa-1.0.0}/.github/release-drafter.yml +0 -0
  49. {apyefa-0.0.6 → apyefa-1.0.0}/.github/workflows/labeler.yml +0 -0
  50. {apyefa-0.0.6 → apyefa-1.0.0}/.github/workflows/python-package.yml +0 -0
  51. {apyefa-0.0.6 → apyefa-1.0.0}/.github/workflows/release_drafter.yml +0 -0
  52. {apyefa-0.0.6 → apyefa-1.0.0}/.vscode/settings.json +0 -0
  53. {apyefa-0.0.6 → apyefa-1.0.0}/LICENSE +0 -0
  54. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/__init__.py +0 -0
  55. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/parsers/__init__.py +0 -0
  56. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/parsers/parser.py +0 -0
  57. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/parsers/rapid_json_parser.py +0 -0
  58. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/commands/parsers/xml_parser.py +0 -0
  59. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa/exceptions.py +0 -0
  60. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa.egg-info/dependency_links.txt +0 -0
  61. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa.egg-info/requires.txt +0 -0
  62. {apyefa-0.0.6 → apyefa-1.0.0}/apyefa.egg-info/top_level.txt +0 -0
  63. {apyefa-0.0.6 → apyefa-1.0.0}/examples.py +0 -0
  64. {apyefa-0.0.6 → apyefa-1.0.0}/setup.cfg +0 -0
  65. {apyefa-0.0.6 → apyefa-1.0.0}/tests/conftest.py +0 -0
  66. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/commands/__init__.py +0 -0
  67. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/commands/parsers/__init__.py +0 -0
  68. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/commands/parsers/test_json_parser.py +0 -0
  69. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/commands/parsers/test_xml_parser.py +0 -0
  70. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/data_classes/__init__.py +0 -0
  71. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/data_classes/test_departure.py +0 -0
  72. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/data_classes/test_location.py +0 -0
  73. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/data_classes/test_system_info.py +0 -0
  74. {apyefa-0.0.6/tests → apyefa-1.0.0/tests/unit}/data_classes/test_transportation.py +0 -0
@@ -1,11 +1,11 @@
1
+ # developing script
2
+ script.py
3
+
1
4
  # Byte-compiled / optimized / DLL files
2
5
  __pycache__/
3
6
  *.py[cod]
4
7
  *$py.class
5
8
 
6
- # C extensions
7
- *.so
8
-
9
9
  # Distribution / packaging
10
10
  .Python
11
11
  build/
@@ -114,12 +114,6 @@ ipython_config.py
114
114
  # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
115
  __pypackages__/
116
116
 
117
- # Celery stuff
118
- celerybeat-schedule
119
- celerybeat.pid
120
-
121
- # SageMath parsed files
122
- *.sage.py
123
117
 
124
118
  # Environments
125
119
  .env
@@ -130,9 +124,6 @@ ENV/
130
124
  env.bak/
131
125
  venv.bak/
132
126
 
133
- # Spyder project settings
134
- .spyderproject
135
- .spyproject
136
127
 
137
128
  # Rope project settings
138
129
  .ropeproject
@@ -145,18 +136,3 @@ venv.bak/
145
136
  .dmypy.json
146
137
  dmypy.json
147
138
 
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/
apyefa-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.1
2
+ Name: apyefa
3
+ Version: 1.0.0
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,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
+
50
+ # Intro
51
+ **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.
52
+
53
+ # Installation
54
+ You only need to install the **apyefa** package, for example using pip:
55
+ ``` bash
56
+ pip install apyefa
57
+ ```
58
+
59
+ # Restrictions
60
+ Currently the package supports only endpoints using [RapidJSON](https://rapidjson.org/) format. To check whether the endpoint supports this format, please call:
61
+ ``` bash
62
+ curl <EFA API URL>/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON
63
+ e.g. curl https://bahnland-bayern.de/efa/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON
64
+ ```
65
+ If API's answer looks like this, endpoint supports rapidJSON:
66
+ ```
67
+ {"version":"10.6.21.17","ptKernel":{"appVersion":"10.6.22.28 build 16.12.2024 11:14:57","dataFormat":"EFA10_06_01","dataBuild":"2024-12-31T00:54:55Z"},"validity":{"from":"2024-12-15","to":"2025-06-14"}}
68
+ ```
69
+
70
+ # Development setup
71
+ Create and activate virtual environment. Then install dependencies required by `apefa` package.
72
+ ``` bash
73
+ python3 -m venv .venv
74
+ source .venv/bin/activate
75
+ pip install .
76
+ ```
77
+
78
+ # apyefa functions
79
+ |Function Name |Description|
80
+ |----------------------------------------------------|-----------|
81
+ |[info()](https://github.com/alex-jung/apyefa/wiki/info)|Provides EFA endpoint system information|
82
+ |[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters and limits|
83
+ |[location_by_coord()](https://github.com/alex-jung/apyefa/wiki/location_by_coord)|Search for location by it's coordinates|
84
+ |[list_lines()](https://github.com/alex-jung/apyefa/wiki/list_lines)|Retrieves a list of lines|
85
+ |[list_stops()](https://github.com/alex-jung/apyefa/wiki/list_stops)|Retrieves a list of stops|
86
+ |[trip()](https://github.com/alex-jung/apyefa/wiki/trip)|Calculates a trip between an origin and a destination locations|
87
+ |[departures_by_location()](https://github.com/alex-jung/apyefa/wiki/departures_by_location)|Fetches departures for a given location|
88
+ |[lines_by_name()](https://github.com/alex-jung/apyefa/wiki/lines_by_name)|Fetches lines by name|
89
+ |[lines_by_location()](https://github.com/alex-jung/apyefa/wiki/lines_by_location)|Fetches lines for a specific location|
90
+ |[line_stops()](https://github.com/alex-jung/apyefa/wiki/line_stops)|Retrieves the stops for a given line|
91
+ |[coord_bounding_box()](https://github.com/alex-jung/apyefa/wiki/coord_bounding_box)|Requests locations within a bounding box|
92
+ |[coord_radial()](https://github.com/alex-jung/apyefa/wiki/coord_radial)|Requests locations within a radius|
93
+ |[geo_object()](https://github.com/alex-jung/apyefa/wiki/geo_object)|Generates a sequence of coordinates and all passed stops of a provided line|
94
+
95
+
96
+ # Example
97
+ ``` python
98
+ import asyncio
99
+ from apyefa import EfaClient
100
+ from apyefa.data_classes import (
101
+ Location,
102
+ LocationFilter,
103
+ )
104
+
105
+ async def async_info(client: EfaClient):
106
+ info = await client.info()
107
+ print(info)
108
+
109
+ async def async_location_by_name(client: EfaClient):
110
+ stops: list[Location] = await client.locations_by_name(
111
+ "Plärrer", filters=[LocationFilter.STOPS], limit=20
112
+ )
113
+ for s in stops:
114
+ print(s)
115
+
116
+ async def main():
117
+ async with EfaClient("https://bahnland-bayern.de/efa/") as client:
118
+ await asyncio.gather(
119
+ async_info(client),
120
+ async_location_by_name(client),
121
+ )
122
+
123
+ if __name__ == "__main__":
124
+ asyncio.run(main())
125
+ ```
apyefa-1.0.0/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # apyefa
2
+ [![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)
3
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ # Intro
6
+ **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.
7
+
8
+ # Installation
9
+ You only need to install the **apyefa** package, for example using pip:
10
+ ``` bash
11
+ pip install apyefa
12
+ ```
13
+
14
+ # Restrictions
15
+ Currently the package supports only endpoints using [RapidJSON](https://rapidjson.org/) format. To check whether the endpoint supports this format, please call:
16
+ ``` bash
17
+ curl <EFA API URL>/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON
18
+ e.g. curl https://bahnland-bayern.de/efa/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON
19
+ ```
20
+ If API's answer looks like this, endpoint supports rapidJSON:
21
+ ```
22
+ {"version":"10.6.21.17","ptKernel":{"appVersion":"10.6.22.28 build 16.12.2024 11:14:57","dataFormat":"EFA10_06_01","dataBuild":"2024-12-31T00:54:55Z"},"validity":{"from":"2024-12-15","to":"2025-06-14"}}
23
+ ```
24
+
25
+ # Development setup
26
+ Create and activate virtual environment. Then install dependencies required by `apefa` package.
27
+ ``` bash
28
+ python3 -m venv .venv
29
+ source .venv/bin/activate
30
+ pip install .
31
+ ```
32
+
33
+ # apyefa functions
34
+ |Function Name |Description|
35
+ |----------------------------------------------------|-----------|
36
+ |[info()](https://github.com/alex-jung/apyefa/wiki/info)|Provides EFA endpoint system information|
37
+ |[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters and limits|
38
+ |[location_by_coord()](https://github.com/alex-jung/apyefa/wiki/location_by_coord)|Search for location by it's coordinates|
39
+ |[list_lines()](https://github.com/alex-jung/apyefa/wiki/list_lines)|Retrieves a list of lines|
40
+ |[list_stops()](https://github.com/alex-jung/apyefa/wiki/list_stops)|Retrieves a list of stops|
41
+ |[trip()](https://github.com/alex-jung/apyefa/wiki/trip)|Calculates a trip between an origin and a destination locations|
42
+ |[departures_by_location()](https://github.com/alex-jung/apyefa/wiki/departures_by_location)|Fetches departures for a given location|
43
+ |[lines_by_name()](https://github.com/alex-jung/apyefa/wiki/lines_by_name)|Fetches lines by name|
44
+ |[lines_by_location()](https://github.com/alex-jung/apyefa/wiki/lines_by_location)|Fetches lines for a specific location|
45
+ |[line_stops()](https://github.com/alex-jung/apyefa/wiki/line_stops)|Retrieves the stops for a given line|
46
+ |[coord_bounding_box()](https://github.com/alex-jung/apyefa/wiki/coord_bounding_box)|Requests locations within a bounding box|
47
+ |[coord_radial()](https://github.com/alex-jung/apyefa/wiki/coord_radial)|Requests locations within a radius|
48
+ |[geo_object()](https://github.com/alex-jung/apyefa/wiki/geo_object)|Generates a sequence of coordinates and all passed stops of a provided line|
49
+
50
+
51
+ # Example
52
+ ``` python
53
+ import asyncio
54
+ from apyefa import EfaClient
55
+ from apyefa.data_classes import (
56
+ Location,
57
+ LocationFilter,
58
+ )
59
+
60
+ async def async_info(client: EfaClient):
61
+ info = await client.info()
62
+ print(info)
63
+
64
+ async def async_location_by_name(client: EfaClient):
65
+ stops: list[Location] = await client.locations_by_name(
66
+ "Plärrer", filters=[LocationFilter.STOPS], limit=20
67
+ )
68
+ for s in stops:
69
+ print(s)
70
+
71
+ async def main():
72
+ async with EfaClient("https://bahnland-bayern.de/efa/") as client:
73
+ await asyncio.gather(
74
+ async_info(client),
75
+ async_location_by_name(client),
76
+ )
77
+
78
+ if __name__ == "__main__":
79
+ asyncio.run(main())
80
+ ```