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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydelijn-2.0.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydelijn-2.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

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

Hashes for pydelijn-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5dc7e1bb55a373da87ebb9843acc34799c1c9ad4d440a40613eb479c9ff9103d
MD5 9dbb2ee1d4fffa9445ff4d7387762256
BLAKE2b-256 5b80c8b7f89ca552de21b9154653e1b583574ef1ddeda6f76d2417c5fac3df9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydelijn-2.0.0.tar.gz:

Publisher: release.yml on bollewolle/pydelijn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pydelijn-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 389e5135158ec657a74157802eaa83e237183e07a0ffc11a8d13ec8e4a7163f1
MD5 9ad4df9144ba014bf1b48296a949f4a2
BLAKE2b-256 99a505b4fe32b1a9badc48f76df9e7864672c437820509849d9ed37caf99dd68

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydelijn-2.0.0-py3-none-any.whl:

Publisher: release.yml on bollewolle/pydelijn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.1

2 files

This release

2.0.0 This release

2 files

1.1.0

2 files

1.0.0

3 files

0.6.1

3 files

0.6.0

1 file

0.5.1

1 file

0.5.0

1 file

0.4.0

1 file

0.3.1

1 file

0.3.0

1 file

0.2.0

1 file

0.1.0

2 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