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.1b0.tar.gz
.
File metadata
- Download URL: enturclient-0.2.1b0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd421468890c81873fefc68ea7fcdfe7b24872c359170fe24bb4df62298685a0 |
|
MD5 | 3299a2468204fdf9a355f5ce2f6bc83a |
|
BLAKE2b-256 | f6148a0a0cf5dc1269c698635905bf500f888c4518fe2a8c78ddacd6251e2898 |
File details
Details for the file enturclient-0.2.1b0-py3-none-any.whl
.
File metadata
- Download URL: enturclient-0.2.1b0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb49983e1f14d61b62c98f2c3d942939eeae29892ff49a5fb3db62cf0a65b8aa |
|
MD5 | 6ed880b14af53fe44f51bbe6e9c55fc8 |
|
BLAKE2b-256 | 343a83863a05b48eb299bef5e57bc4d2ffd5bf826076eb90fe09238df753b9e1 |