Skip to main content

Python interface to the Live Departure Boards

Project description

pyLDB - Python interface to the Live Departure Boards

PyPI PyPI PyPI Build Status

A simple library for getting live departure boards from the National Rail Enquiries Darwin service (via OpenLDBWS). Designed to wrap the SOAP code with a simple interface.

This library is currently minimal but functional. See sample/get_board.py for an example of how to retrieve the current departure board for a station and render it to an HTML page.

To run this code you will need your own access token which you have to get from National Rail Enquiries.

If you're not in the UK or not interested in train data from the UK, this code probably won't help you.

Technical

This library relies on two others: suds to do a SOAP call into the LDBWS service, and jinja2 for the HTML templating.

SOAP is a framework for remote APIs, typically over HTTP but other transport layers are supported, which predates REST. It uses XML, and relies on XML documents in a WSDL language to define the specifics of the API, including function signatures and all the custom types used by the API. It's usually a bit more complicated to setup a SOAP connection than to hit a REST api, but the use of strong types can make them very powerful. The code in this library provides a minimal proof of concept of how to retrieve live departure board data from the SOAP service using Python. For some peope that might be all you need.

Due to the choice of a port of suds to Python 3, this library does not currently work at all with Python 2. It is testing with Python versions 3.4, 3.5 and 3.6.

Jinja2 is an awesome templating library for Python which is used in Flask and Ansible among many other projects. Its use here is straightforward, and if you look at the basic HTML template, you can probably figure out how to write a template for either a differently structured HTML document, or a different document type altogether.

National Rail Enquiries is a UK organization which provides information about train times and fares on the National Rail system. The Live Departure Board service is a web API which shows trains scheduled to depart from a given station, along with information about their expected departure times, etc. This is the same data, updated live, which is used in mapping apps - since 2015 it is also the same data shown on departure boards in train stations, since these boards also rely on the same API.

See also

This code is libre software and might help you get your own project working. There are several other projects which get train departure boards using Python:

Important

National Rail Enquiries is the data provider for the API which this code wraps. However, this library is not approved, endorsed or supported by National Rail Enquiries. Information about Darwin Data Feeds provided by NRE (of which LDBWS is one) is at (https://www.nationalrail.co.uk/100296.aspx).

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

pyldb-0.6.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

pyldb-0.6.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file pyldb-0.6.0.tar.gz.

File metadata

  • Download URL: pyldb-0.6.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.2 Linux/5.15.84-v7+

File hashes

Hashes for pyldb-0.6.0.tar.gz
Algorithm Hash digest
SHA256 7ecf8d6f8709910a9134261c2c02a74c3442a81fedc709380ff1ae1ce9914d30
MD5 220daf6338b88d885e7d942cd0b17b98
BLAKE2b-256 99c305b5dba9f97308e039b985cdc5ce0d2e9d90b0fc109263a2e80ba4a22ff3

See more details on using hashes here.

File details

Details for the file pyldb-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: pyldb-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.2 Linux/5.15.84-v7+

File hashes

Hashes for pyldb-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12c1336ad3e93ec3bb76588df7d07c1f58b56f949433fccb394c4c3f13b6da2c
MD5 7b0feb82b42edf3e7bd11e3da2493c87
BLAKE2b-256 331d4b3b409e714380aa8471e58ca7f2ee95e74db58acd47242553c3610ace71

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