Skip to main content

Entur API client

Python client for fetching estimated departures from stop places in Norway from entur.org API. Information about stop places, platforms and real-time departures.

PyPI version fury.io PyPI pyversions

Buy me a coffee

Usage

import aiohttp
import asyncio
from enturclient import EnturPublicTransportData

API_CLIENT_ID = 'awesome_company - my_application'

async def print_bergen_train_delay():
    async with aiohttp.ClientSession() as client:
        stops = ['NSR:StopPlace:548']
        quays = ['NSR:Quay:48550']

        data = EnturPublicTransportData(
            client_name=API_CLIENT_ID, # Required
            stops=stops,
            quays=quays,
            omit_non_boarding=True,
            number_of_departures=5,
            web_session=client) # recommended argument

        await data.update()

        bergen_train = data.get_stop_info('NSR:StopPlace:548')
        bergen_train_delay = bergen_train.estimated_calls[0].delay_in_min

        print(bergen_train_delay)

asyncio.run(print_bergen_train_delay())

Obtaining a stop id

Entur's travel planer has a map of all stops used in Norway. Use the map to find the stops you're interested in. When you have found one of your stops, click on it, and hit "Se alle avganger".

Now the web browser should contain an URL with the id in it. Such as this: https://en-tur.no/nearby-stop-place-detail?id=NSR:StopPlace:32376

The stop id is the content after id= parameter in the url. Copy paste this into the configuration.

It's also possible to use the National Stop Register (NSR). Find your stop in the map, click on it and then again at the name. You have to zoom quite a bit in before the stops shows in the map. Information about the stop place, including the stop and quay ids will pop up on the side.

Release files for enturclient 0.3.0

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

Source distribution (sdist)

Source distribution for enturclient 0.3.0
File Size Uploaded
enturclient-0.3.0.tar.gz 6.7 kB Details

Built distribution (wheel)

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

Total release size: 14.3 kB

Release files / enturclient-0.3.0.tar.gz

Download URL enturclient-0.3.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a58232280f2ffdcbf2e32e928f5cb0d11eeb917d3bbab23b98eb8e58bf71032c
BLAKE2b-256 checksum
How to use checksums
2c7298b304e8c5942e7cab6e164ee5aaa6a45d0f78430729c9ec952188be37ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / enturclient-0.3.0-py3-none-any.whl

Download URL enturclient-0.3.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a674a26c001207783b121c9abb56935bdecb1aa24434b54e69fbba0c6282d6c4
BLAKE2b-256 checksum
How to use checksums
051ab9d8ecf0d94d111a57617378bc7c61f7f457587075ba4602616e2927db6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15
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