Skip to main content

apyefa

Python package License

Intro

apyefa is a python package used to asynchronously fetch public transit routing data via EFA interfaces like efa.vgn. 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:

pip install apyefa

Restrictions

Currently the package supports only endpoints using RapidJSON format. To check whether the endpoint supports this format, please call:

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.

python3 -m venv .venv
source .venv/bin/activate
pip install .

apyefa functions

Function Name Description
info() Provides EFA endpoint system information
locations_by_name() Search for locations by name with optional filters
locations_by_coord() Search for locations by coordinates
list_lines() Retrieves a list of lines
list_stops() Retrieves a list of stops
trip() Calculates a trip between an origin and a destination locations
departures_by_location() Fetches departures for a given location
lines_by_name() Fetches lines by name
lines_by_location() Fetches lines for a specific location
line_stops() Retrieves the stops for a given line
coord_bounding_box() Requests locations within a bounding box
coord_radial() Requests locations within a radius
geo_object() Generates a sequence of coordinates and all passed stops of a provided line

Example

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())

Metadata

Release files for apyefa 1.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apyefa 1.1.8
File Size Uploaded
apyefa-1.1.8.tar.gz 129.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apyefa 1.1.8
File Interpreter ABI Platform
apyefa-1.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 155.7 kB

Release files / apyefa-1.1.8.tar.gz

Download URL apyefa-1.1.8.tar.gz
Size 129.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4459fbbb041eef9c8848708d7d9ab48a929e48c6562bc99ebfcfd93a76184a3c
BLAKE2b-256 checksum
How to use checksums
dc4a9ea15fce94e55ea3a034468e94ff060e5a5ad8cddb5a1b0cf0bc975663d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / apyefa-1.1.8-py3-none-any.whl

Download URL apyefa-1.1.8-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9218d82101eb9978b9fac2c693d7bbf4df54302c9f445a90cff73924f20bfc4
BLAKE2b-256 checksum
How to use checksums
162e918008428262d6e759e6bd94edd70d5837c77a4cc760a6a467505f6670b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

1.1.8 This release

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page