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). 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.3.0b1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

enturclient-0.3.0b1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file enturclient-0.3.0b1.tar.gz.

File metadata

  • Download URL: enturclient-0.3.0b1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for enturclient-0.3.0b1.tar.gz
Algorithm Hash digest
SHA256 5452a725420321908344ee49e2f1b7abad1a0cc9c120fe6f325114d1c23da4b6
MD5 721f9723f374996f22e3d1810f7004ae
BLAKE2b-256 a6553d0e9aa92f57d42e644469b6fdff8a4fa241677b1cf32c4ebcd18c614724

See more details on using hashes here.

File details

Details for the file enturclient-0.3.0b1-py3-none-any.whl.

File metadata

  • Download URL: enturclient-0.3.0b1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for enturclient-0.3.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 a518e820b112678b583e639d3c96c91f6e192673eb70f57130a04a8ea9de1e92
MD5 a1320cb4173a53b6851e1a8377497723
BLAKE2b-256 584a4375d36b81454316b53c0ed20b384f2d49879f338c0f62564dc489ffffd0

See more details on using hashes here.

Supported by

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