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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file enturclient-0.2.0b3.tar.gz
.
File metadata
- Download URL: enturclient-0.2.0b3.tar.gz
- Upload date:
- Size: 4.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8893ca036022ec7f8f7e3077dd524d34bf6d9d8c3bf9c9b90f8589a2a21b6c6 |
|
MD5 | 3416e7949e58d153a4db4b2b9031ad64 |
|
BLAKE2b-256 | 5f6cac5c30021fc96ec6f287abb5bb90cd87f767f4b73f1a95e5762228459873 |
File details
Details for the file enturclient-0.2.0b3-py3-none-any.whl
.
File metadata
- Download URL: enturclient-0.2.0b3-py3-none-any.whl
- Upload date:
- Size: 6.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e14753e0fdf6c0cc175c1a56a6f76b70d2cc0907c40fd0bd0efbf3ea25f4f85 |
|
MD5 | 1c5a95db0d9bb4264b4083370f5e0bb9 |
|
BLAKE2b-256 | 3c9029ac01af8b194491f5d6819fced15c67cd5956df90123272d29cd80bd2a7 |