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's 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)

loop = asyncio.get_event_loop()
loop.run_until_complete(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. 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.

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.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

enturclient-0.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file enturclient-0.2.0.tar.gz.

File metadata

  • Download URL: enturclient-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for enturclient-0.2.0.tar.gz
Algorithm Hash digest
SHA256 320b974faac9fc94bbd7ad498e11b0dbbeb7678cfcd5684c26cbcf1621861e27
MD5 3f53fee059ae6c72625da78da536b203
BLAKE2b-256 fa555d97cd3d9bb722144ef4859c7b5af06ce248925b72068c2931266ee5dfbc

See more details on using hashes here.

File details

Details for the file enturclient-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: enturclient-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for enturclient-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31fc19afabcc4a6b82ba92ae65cad0e29b475054ffb736b444c2f288c87b26a7
MD5 0cebb92fa0514b3acafe6c36706869f9
BLAKE2b-256 5e6bf36076238b7be87c4c313da8eb2e5610f0702eff921214e37994ec95a3bf

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