Skip to main content

An API client for public transport data from Entur.

Project description

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). Log in as "guest"/"guest" at https://stoppested.entur.org to explore the contents of 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.

Project details


Download files

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

Source Distribution

enturclient-0.2.2b7.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

enturclient-0.2.2b7-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file enturclient-0.2.2b7.tar.gz.

File metadata

  • Download URL: enturclient-0.2.2b7.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.10

File hashes

Hashes for enturclient-0.2.2b7.tar.gz
Algorithm Hash digest
SHA256 7bf39810c77f9af1697ebe2729da56127788dc3768c903ff7a026344bde305d2
MD5 7a8b8c8a1c741c2819d3d093279a022d
BLAKE2b-256 599a99b33182f59e03a181219c660dbeb8c77cd49e252abcb4de5b7660b39c8d

See more details on using hashes here.

File details

Details for the file enturclient-0.2.2b7-py3-none-any.whl.

File metadata

  • Download URL: enturclient-0.2.2b7-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.10

File hashes

Hashes for enturclient-0.2.2b7-py3-none-any.whl
Algorithm Hash digest
SHA256 3f001a7f0c2698788aa53f1bd1168efe0f276965f04b5c50155ac4c64fcd82df
MD5 9ad5e3b62a97b92230d85c42693cddab
BLAKE2b-256 4f16f1ffa71a2714331907fb6aa145dc48cbf8f4880c65e3ce5db51772d1e280

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page