pydelijn
An async, fully typed Python client for the De Lijn (Flemish public transport) open data API. It retrieves stops, lines, and realtime/scheduled passages.
Its primary purpose is to feed the De Lijn integration in Home Assistant.
Important: a developer account at https://data.delijn.be is required to generate a subscription key for the Core and Search open data APIs.
v2 is a breaking rewrite. The old dict-based
pydelijn.api.PassagesAPI is gone, replaced byDeLijnClientwith typed models and exceptions. Docs for v1 are available in the git history.
Install
pip install pydelijn
Usage
import asyncio
from pydelijn import DeLijnClient
from pydelijn.exceptions import DeLijnError
async def main() -> None:
api_key = "<your data.delijn.be subscription key>"
async with DeLijnClient(api_key) as client:
stops = await client.search_stops("Antwerpen Rooseveltplaats")
stop = stops[0]
passages = await client.get_passages(stop.number, max_passages=5)
for passage in passages:
print(
f"Line {passage.line.public_number} to {passage.destination}: "
f"due at {passage.due_at} (realtime={passage.is_realtime})"
)
asyncio.run(main())
Errors are raised as typed exceptions (DeLijnConnectionError,
DeLijnAuthError, DeLijnNotFoundError, DeLijnResponseError, all
subclasses of DeLijnError) rather than logged and swallowed, so callers
(e.g. a Home Assistant DataUpdateCoordinator) can react to failures.
You may pass in your own aiohttp.ClientSession; if you don't, one is
created lazily and closed by client.close() (or on exiting async with).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydelijn-2.0.0.tar.gz.
File metadata
- Download URL: pydelijn-2.0.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dc7e1bb55a373da87ebb9843acc34799c1c9ad4d440a40613eb479c9ff9103d
|
|
| MD5 |
9dbb2ee1d4fffa9445ff4d7387762256
|
|
| BLAKE2b-256 |
5b80c8b7f89ca552de21b9154653e1b583574ef1ddeda6f76d2417c5fac3df9f
|
Provenance
The following attestation bundles were made for pydelijn-2.0.0.tar.gz:
Publisher:
release.yml on bollewolle/pydelijn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydelijn-2.0.0.tar.gz -
Subject digest:
5dc7e1bb55a373da87ebb9843acc34799c1c9ad4d440a40613eb479c9ff9103d - Sigstore transparency entry: 2368976117
- Sigstore integration time:
-
Permalink:
bollewolle/pydelijn@2fd2300ed7dd8d8c71658315fbcd347185ee27ec -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/bollewolle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2fd2300ed7dd8d8c71658315fbcd347185ee27ec -
Trigger Event:
release
-
Statement type:
File details
Details for the file pydelijn-2.0.0-py3-none-any.whl.
File metadata
- Download URL: pydelijn-2.0.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
389e5135158ec657a74157802eaa83e237183e07a0ffc11a8d13ec8e4a7163f1
|
|
| MD5 |
9ad4df9144ba014bf1b48296a949f4a2
|
|
| BLAKE2b-256 |
99a505b4fe32b1a9badc48f76df9e7864672c437820509849d9ed37caf99dd68
|
Provenance
The following attestation bundles were made for pydelijn-2.0.0-py3-none-any.whl:
Publisher:
release.yml on bollewolle/pydelijn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydelijn-2.0.0-py3-none-any.whl -
Subject digest:
389e5135158ec657a74157802eaa83e237183e07a0ffc11a8d13ec8e4a7163f1 - Sigstore transparency entry: 2368976718
- Sigstore integration time:
-
Permalink:
bollewolle/pydelijn@2fd2300ed7dd8d8c71658315fbcd347185ee27ec -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/bollewolle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2fd2300ed7dd8d8c71658315fbcd347185ee27ec -
Trigger Event:
release
-
Statement type: