Random Journey Planner

Loosely based on some Python code I found - https://gitlab.com/JoshBl_/python/-/blob/2d873b2f251be8d34d69f411fb7a7931a27ca61d/TfL%20App/tfl-app.py
I built a web app with a Flask backend and an Adapt UI frontend which generates random journeys on the TfL network. The code is on GitHub - GitHub - tramcrazy/Random-TfL-Journey: Generate randomised journeys to take on the TfL network!
Things I need to improve:
Currently it uses station/tram stop names which leads to inaccuracy when the API is called. I should make a list of icscode/naptan id if I can find this info and use that instead. Open to suggestions - I haven’t hosted it anywhere as that would probably cost me money but might put it on PythonAnywhere if anyone is interested and doesn’t want to run it themselves.

You can easily obtain all of the codes in the https://tfl.gov.uk/tfl/syndication/feeds/journey-planner-timetables.zip file. Once you’ve unzipped it you just have to dig into the TransXChange coded files and save what you want.

This file is updated at least weekly.

Thanks, that’s really useful. I will try and update in the next few days.

update - I am in the files. It seems like there are multiple naptan id’s for each station? Is there one per platform? e.g. at Abbey Road DLR there is 9400ZZDLABR1 and 9400ZZDLRABR2. Which would I be best off using when querying the journey api?

I have now fixed the Python code so it pulls the list of stations from a relative path using os.path - I completely forgot that I had hardcoded the path of the file on my machine - sorry!

These are platform codes, the ones for the station as a whole is 940GZZDLABR