Name | apyefa JSON |
Version |
1.1.0
JSON |
| download |
home_page | None |
Summary | Python API for EFA(Elektronische Fahrplanauskunft) async requests |
upload_time | 2025-01-28 18:07:07 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.11 |
license | MIT License Copyright (c) 2024 Alex Jung Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
efa
public transport
traffic
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# apyefa
[![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)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# Intro
**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.
# Installation
You only need to install the **apyefa** package, for example using pip:
``` bash
pip install apyefa
```
# Restrictions
Currently the package supports only endpoints using [RapidJSON](https://rapidjson.org/) format. To check whether the endpoint supports this format, please call:
``` bash
curl <EFA API URL>/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON
e.g. curl https://bahnland-bayern.de/efa/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON
```
If API's answer looks like this, endpoint supports rapidJSON:
```
{"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"}}
```
# Development setup
Create and activate virtual environment. Then install dependencies required by `apefa` package.
``` bash
python3 -m venv .venv
source .venv/bin/activate
pip install .
```
# apyefa functions
|Function Name |Description|
|----------------------------------------------------|-----------|
|[info()](https://github.com/alex-jung/apyefa/wiki/info)|Provides EFA endpoint system information|
|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters|
|[locations_by_coord()](https://github.com/alex-jung/apyefa/wiki/locations_by_coord)|Search for locations by coordinates|
|[list_lines()](https://github.com/alex-jung/apyefa/wiki/list_lines)|Retrieves a list of lines|
|[list_stops()](https://github.com/alex-jung/apyefa/wiki/list_stops)|Retrieves a list of stops|
|[trip()](https://github.com/alex-jung/apyefa/wiki/trip)|Calculates a trip between an origin and a destination locations|
|[departures_by_location()](https://github.com/alex-jung/apyefa/wiki/departures_by_location)|Fetches departures for a given location|
|[lines_by_name()](https://github.com/alex-jung/apyefa/wiki/lines_by_name)|Fetches lines by name|
|[lines_by_location()](https://github.com/alex-jung/apyefa/wiki/lines_by_location)|Fetches lines for a specific location|
|[line_stops()](https://github.com/alex-jung/apyefa/wiki/line_stops)|Retrieves the stops for a given line|
|[coord_bounding_box()](https://github.com/alex-jung/apyefa/wiki/coord_bounding_box)|Requests locations within a bounding box|
|[coord_radial()](https://github.com/alex-jung/apyefa/wiki/coord_radial)|Requests locations within a radius|
|[geo_object()](https://github.com/alex-jung/apyefa/wiki/geo_object)|Generates a sequence of coordinates and all passed stops of a provided line|
# Example
``` python
import asyncio
from apyefa import EfaClient
from apyefa.data_classes import (
Location,
LocationFilter,
)
async def async_info(client: EfaClient):
info = await client.info()
print(info)
async def async_location_by_name(client: EfaClient):
stops: list[Location] = await client.locations_by_name(
"Plärrer", filters=[LocationFilter.STOPS], limit=20
)
for s in stops:
print(s)
async def main():
async with EfaClient("https://bahnland-bayern.de/efa/") as client:
await asyncio.gather(
async_info(client),
async_location_by_name(client),
)
if __name__ == "__main__":
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": null,
"name": "apyefa",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "efa, public transport, traffic",
"author": null,
"author_email": "Alex Jung <jungdevelop@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/53/59/65cd9ec96cab792b7cfd0b79f7cda0190d00c98b1a6837e5618036e0e3bc/apyefa-1.1.0.tar.gz",
"platform": null,
"description": "# apyefa\n[![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)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# Intro\n**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.\n\n# Installation\nYou only need to install the **apyefa** package, for example using pip:\n``` bash\npip install apyefa\n```\n\n# Restrictions\nCurrently the package supports only endpoints using [RapidJSON](https://rapidjson.org/) format. To check whether the endpoint supports this format, please call:\n``` bash\ncurl <EFA API URL>/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON\ne.g. curl https://bahnland-bayern.de/efa/XML_SYSTEMINFO_REQUEST?outputFormat=rapidJSON\n```\nIf API's answer looks like this, endpoint supports rapidJSON:\n```\n{\"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\"}}\n```\n\n# Development setup\nCreate and activate virtual environment. Then install dependencies required by `apefa` package.\n``` bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install .\n```\n\n# apyefa functions\n|Function Name |Description|\n|----------------------------------------------------|-----------|\n|[info()](https://github.com/alex-jung/apyefa/wiki/info)|Provides EFA endpoint system information|\n|[locations_by_name()](https://github.com/alex-jung/apyefa/wiki/locations_by_name)|Search for locations by name with optional filters|\n|[locations_by_coord()](https://github.com/alex-jung/apyefa/wiki/locations_by_coord)|Search for locations by coordinates|\n|[list_lines()](https://github.com/alex-jung/apyefa/wiki/list_lines)|Retrieves a list of lines|\n|[list_stops()](https://github.com/alex-jung/apyefa/wiki/list_stops)|Retrieves a list of stops|\n|[trip()](https://github.com/alex-jung/apyefa/wiki/trip)|Calculates a trip between an origin and a destination locations|\n|[departures_by_location()](https://github.com/alex-jung/apyefa/wiki/departures_by_location)|Fetches departures for a given location|\n|[lines_by_name()](https://github.com/alex-jung/apyefa/wiki/lines_by_name)|Fetches lines by name|\n|[lines_by_location()](https://github.com/alex-jung/apyefa/wiki/lines_by_location)|Fetches lines for a specific location|\n|[line_stops()](https://github.com/alex-jung/apyefa/wiki/line_stops)|Retrieves the stops for a given line|\n|[coord_bounding_box()](https://github.com/alex-jung/apyefa/wiki/coord_bounding_box)|Requests locations within a bounding box|\n|[coord_radial()](https://github.com/alex-jung/apyefa/wiki/coord_radial)|Requests locations within a radius|\n|[geo_object()](https://github.com/alex-jung/apyefa/wiki/geo_object)|Generates a sequence of coordinates and all passed stops of a provided line|\n\n\n# Example\n``` python\nimport asyncio\nfrom apyefa import EfaClient\nfrom apyefa.data_classes import (\n Location,\n LocationFilter,\n)\n\nasync def async_info(client: EfaClient):\n info = await client.info()\n print(info)\n\nasync def async_location_by_name(client: EfaClient):\n stops: list[Location] = await client.locations_by_name(\n \"Pl\u00e4rrer\", filters=[LocationFilter.STOPS], limit=20\n )\n for s in stops:\n print(s) \n\nasync def main():\n async with EfaClient(\"https://bahnland-bayern.de/efa/\") as client:\n await asyncio.gather(\n async_info(client),\n async_location_by_name(client),\n )\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Alex Jung Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Python API for EFA(Elektronische Fahrplanauskunft) async requests",
"version": "1.1.0",
"project_urls": {
"Documentation": "https://github.com/alex-jung/apyefa",
"Homepage": "https://github.com/alex-jung/apyefa",
"Issues": "https://github.com/alex-jung/apyefa/issues",
"Repository": "https://github.com/alex-jung/apyefa"
},
"split_keywords": [
"efa",
" public transport",
" traffic"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8c3d38801c123caf977aaa1c3b7ec33bac625d880c163326fcf4f7d9dd405a76",
"md5": "2320f73fbd116f6f3a90b6d00bb31c22",
"sha256": "0264cdec4d22b7d67fdba97e21b61dcdd4f226cce209db97c747e9573c24eea4"
},
"downloads": -1,
"filename": "apyefa-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2320f73fbd116f6f3a90b6d00bb31c22",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 26635,
"upload_time": "2025-01-28T18:07:06",
"upload_time_iso_8601": "2025-01-28T18:07:06.099622Z",
"url": "https://files.pythonhosted.org/packages/8c/3d/38801c123caf977aaa1c3b7ec33bac625d880c163326fcf4f7d9dd405a76/apyefa-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "535965cd9ec96cab792b7cfd0b79f7cda0190d00c98b1a6837e5618036e0e3bc",
"md5": "3b3d8d9e1061f7451ac5a50a8019587a",
"sha256": "0ea136276578ba6cc5e12060c8b40981a32b2e6db71abf0f2a3de62b350747b6"
},
"downloads": -1,
"filename": "apyefa-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "3b3d8d9e1061f7451ac5a50a8019587a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 32031,
"upload_time": "2025-01-28T18:07:07",
"upload_time_iso_8601": "2025-01-28T18:07:07.843432Z",
"url": "https://files.pythonhosted.org/packages/53/59/65cd9ec96cab792b7cfd0b79f7cda0190d00c98b1a6837e5618036e0e3bc/apyefa-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-28 18:07:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alex-jung",
"github_project": "apyefa",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "apyefa"
}