Skip to main content

Simplified data retrieval from Entur in Python

Project description

Pythentur

Entur data-fetch in Python

This package provides functions for simple fetching of real-time public transport data - as provided by Entur. As an added bonus, the nsrGet-function makes it easy to obtain the NSR ID of a stop place by a search string.

Installation

pip install pythentur

Dependencies:

  • Requests

Usage

StopPlace object

Create a StopPlace object by handing in the NSR ID to the constructor.

from pythentur import StopPlace
oslo_s = StopPlace("NSR:StopPlace:59872")

This stores the ID and a pre-made query template in the GraphQL format.

Pythentur supports custom query templates, if you wish to retrieve more data. This is given to the constructor with the query argument.

query_template = "<graphQL query>"
oslo_s = StopPlace("NSR:StopPlace:59872", query = query_template)

StopPlace.get() method

This method makes a request to the Entur GraphQL API, and retrives a list of calls, each represented by a dictionary.

from pythentur import StopPlace
oslo_s = StopPlace("NSR:StopPlace:59872")
data = oslo_s.get()

Here, data is a list of dictionaries, each containing:

  • 'platform': String containing the platform this call is arriving on. May be a blank string if the stop place does not have different specified platforms.
  • 'line': String containing the line number and name of the arriving transport.
  • 'aimedArrivalTime': Datetime object containing the planned arrival time of the call.
  • 'expectedArrivalTime': Datetime object containing the expected arrival time of the call.
  • 'delay': Timedelta object containing the calculated delay of the call.

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

pythentur-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

pythentur-0.0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pythentur-0.0.2.tar.gz.

File metadata

  • Download URL: pythentur-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for pythentur-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ec53511f5793cdac2e2fe76d7eb48303e64e1c2cdc11d3146d1a6926d57ef74e
MD5 fcd35ec380203cd3b5ced9586962c79e
BLAKE2b-256 07078ab6ffdd30a85473946b8226dc8f2bcb4397a2514a1a933e4f07bc1e7eb7

See more details on using hashes here.

File details

Details for the file pythentur-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pythentur-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for pythentur-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dbebf2b470a8e84f8df24647162c56d108f7d800cd9f6299e6d0ef2ba2524d63
MD5 f7dec38a2820d9c0aa2f8215e71f099f
BLAKE2b-256 9863856d064908e054f44910482e9648aca0c33d14ec9c38ce8b68dc5e937568

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