A simple python wrapper around National Rail Enquires LDBS SOAP Webservice
nre-darwin-py provides an abstraction layer for accessing National Rail Enquiries Darwin service via their LDB SOAP web service. This service provides live departure board information for all United Kingdom train stations.
This module has the following goals:
You will need to register for Darwin access, you can do this via National Rail Enquiries developer site.
Then install nre-darwin-py:
pip install nre-darwin-py
Initiate a session:
>>> from nredarwin.webservice import DarwinLdbSession >>> darwin_sesh = DarwinLdbSession(wsdl="https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx", api_key="YOUR_KEY")
Retrieve the departure board for Manchester Piccadilly station:
>>> board = darwin_sesh.get_station_board('MAN') >>> board.location_name 'Manchester Piccadilly' >> board.train_services.destination_text 'Rose Hill Marple'
Retrieve more detailed information regarding a particular service:
>>> service_id = board.train_services.service_id >>> service = darwin_sesh.get_service_details(service_id) >>> [cp.location_name for cp in service.subsequent_calling_points] [Gorton, Fairfield, Guide Bridge, Hyde Central, Woodley, Romiley, Rose Hill Marple]
The provided example.py script shows a simple departure board implementation for your reference
Additional contributions by George Goldberg. Advice on SUDS proxy issues from Pete Barking.