Skip to main content

pydelijn

Build Status

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.Passages API is gone, replaced by DeLijnClient with 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).

Metadata

Release files for pydelijn 2.0.1

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

Source distribution (sdist)

Source distribution for pydelijn 2.0.1
File Size Uploaded Provenance Actions
pydelijn-2.0.1.tar.gz 12.3 kB With provenance Details for pydelijn-2.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 21.8 kB

Release files / pydelijn-2.0.1.tar.gz

Download URL pydelijn-2.0.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2893e767efdbf85a09fb360c01be660457d71be99753168fcf85e9b8a5519bb2
BLAKE2b-256 checksum
How to use checksums
47624e929c8bf043b0053cffaf9e80eb05a3e9c85892738c1cc1c8df531b0c9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release files / pydelijn-2.0.1-py3-none-any.whl

Download URL pydelijn-2.0.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fdf0dbe6925ec4d54c8f802a550666bfc993b795c56a3b067378e9f0ed792ec
BLAKE2b-256 checksum
How to use checksums
582706feb33b8ce8ca92619304f580a171f5ed7b99fd45c14943bffcde78784d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Security for pydelijn 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydelijn-2.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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