TFL Updates

I’ve been working on a little side project to learn about Python and API interaction. That mini project was to interact with the TFL API and retrieve travel updates.

TFL used to maintain several Twitter accounts that each posted updates about the lines such as delays, cancellations, and so forth. TFL chose to cancel these accounts which deprived people (including me) of easily accessible status updates for the lines used by various commuters.

I decided to put together a script and use that to learn about all of this and also serverless and Cloud Run for Anthos, since I tinker a lot in Kubernetes.

The result is a service that retrieves the updates from the TFL API, stores the updates in a Redis cluster, and tweets any new updates to a Twitter account located at https://twitter.com/UpdatesBf.

I then tacked onto this an RSS Generator, also using Python. So you can go to something like https://piccadilly.blenderfox.net/ to get the Piccadilly Line updates within the last 24 hours.

Since I added busses to the service, the amount of tweets exponentially grew, since bus services can be very volatile in updates due to their vulnerability to road conditions such as collisions, fires and water leaks, not to mention there are a LOT of busses in London.

I decided to use hashtags to allow people to watch specific updates.

Each of the links below will take you to a Twitter search that has the hashtags already filled in

Tube/TFL Rail Hashtags (#BF_XXX)

  • BKL – Bakerloo Line
  • CTL – Central Line
  • CIR – Circle Line
  • DIS – District Line
  • DLR – Docklands Light Railway
  • HCT – Hammersmith & City Line
  • JBL – Jubilee Line
  • LIZ – Elizabeth Line
  • LOG – London Overground
  • MET – Metropolitan Line
  • NOR – Northern Line
  • PIC – Piccadilly Line
  • VIC – Victoria Line
  • WLC – Waterloo & City Line

Bus Hashtags (#BF_BUS_XXXX)

Bus Routes are all formatted #BF_BUS_XXXX, where XXX is the bus route number. So #BF_BUS_123 for example will be the hashtag used by the 123 Route. Similarly #BF_BUS_N97 will be for Night Bus Route N97

National Rail Hashtags (#BF_NR_XXXX)

National Rail updates from the TFL API are very poor in that you only get things like “Good Service”, “Minor Delays”, or “Special Service”. So these are currently disabled while I figure an alternative source

  • AWC – Avanti West Coast
  • C2C – c2c
  • CRY – Chiltern Railways
  • CCY – Cross Country
  • EMR – East Midland Railway
  • FHT – First Hull Trains
  • FTPE – First TransPennine Express
  • GWX – Gatwick Express
  • GCT – Grand Central
  • GTA – Greater Anglia
  • GNR – Great Northern
  • GWR – Great Western Railway
  • HRX – Heathrow Express
  • ISL – Island Line
  • LNER – London North Eastern Railway
  • MRR – MerseryRail
  • NRL – Northern Rail
  • SCR – ScotRail
  • SER – SouthEastern
  • SOR – Southern
  • SWR – South Western Railway
  • TLR – ThamesLink
  • TFW – Transport for Wales
  • WMT – West Midlands Trains

River Bus Hashtags (#BF_RB_XXXX)

  • CCR – City Cruises
  • RB1 – RB1 Service
  • RB2 – RB2 Service
  • RB4 – RB4 Service
  • RB6 – RB6 Service
  • TRS – Thames River Services
  • WLF – Woolwich Ferry

Other Services Hashtags (#BF_XXXX)

  • EAL – Emirates Air Line
  • TRM – Tram