Find a file
Edward Betts 453d6244ec Stream results progressively via SSE instead of waiting for full render
The loading page now opens an EventSource to a new ?render=stream endpoint.
The server immediately sends a shell event (full page chrome: nav, filters,
JS — no external fetches needed), then a section event per direction as each
one's NR + Eurostar data arrives, and finally a done event with the summary
and timetable-refresh URL. The client slots each section card into a
placeholder and calls initialiseResultsPage() only after done, so fares and
advance-fare streaming start at the right moment.

Adds results_shell.html (shell template with empty JS data globals and
mergeSectionData/finaliseResults hooks), results_section.html (extracted
section card partial used by both the full and stream render paths), and
helper functions _section_trip_fares() and _build_summary_html() to avoid
duplicating fare-dict assembly between the two paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 21:24:40 +01:00
config Tidy results table layout and centralise connection defaults 2026-04-10 13:11:26 +01:00
data Remove some starting stations. 2026-04-07 14:37:03 +01:00
scraper Add return and inbound journey support 2026-05-21 08:46:35 +01:00
static Add favicon asset 2026-05-20 15:52:45 +01:00
templates Stream results progressively via SSE instead of waiting for full render 2026-05-25 21:24:40 +01:00
tests Relabel inbound circle line services: Circle (aim for) and next (fallback) 2026-05-21 18:48:14 +01:00
.codex Add Codex marker file 2026-05-20 15:53:07 +01:00
.gitignore Add config system with TFL_DATA_DIR and CACHE_DIR 2026-04-04 13:37:44 +01:00
app.py Stream results progressively via SSE instead of waiting for full render 2026-05-25 21:24:40 +01:00
cache.py Cache provisional weekday timetables 2026-05-21 11:31:17 +01:00
circle_line.md Add travel fare notes 2026-05-20 15:52:50 +01:00
circle_line.py Split return date nav into separate outbound/return rows; show earlier tube option on inbound 2026-05-21 14:09:36 +01:00
more_prices.md Add Eurostar Plus prices and NR advance fare support 2026-04-11 16:22:24 +01:00
prices.md Add travel fare notes 2026-05-20 15:52:50 +01:00
pyproject.toml Initial commit. 2026-03-30 19:34:46 +01:00
README.md Move inline styles to CSS classes; update README 2026-04-04 15:39:04 +01:00
requirements.txt Initial commit. 2026-03-30 19:34:46 +01:00
run.fcgi Add FastCGI entrypoint 2026-05-20 15:52:47 +01:00
tfl_fare.py Add Circle line fare to Transfer column and Total 2026-04-11 16:47:34 +01:00
trip_planner.py Five UI and data features for return journeys and results page 2026-05-25 14:58:32 +01:00

Bristol Eurostar

Source: https://git.4angle.com/edward/bristol-eurostar

Plan a trip from Bristol Temple Meads to Europe via Eurostar.

Combines GWR trains (Bristol → Paddington) with Eurostar services (St Pancras → destination) and shows all valid same-day connections, including Circle Line times for the Paddington → St Pancras transfer. Displays GWR walk-on fares, Eurostar Standard prices, seat availability, and total journey cost.

Destinations

  • Paris Gare du Nord
  • Brussels Midi
  • Lille Europe
  • Amsterdam Centraal
  • Rotterdam Centraal
  • Cologne Hbf

How it works

Train times and prices are fetched from two sources:

  • GWR — scraped from Realtime Trains using httpx
  • Eurostar — fetched from the Eurostar GraphQL API (single call returns timetable, Standard fares, and seat availability)

The Paddington → St Pancras transfer uses a real Circle Line timetable parsed from a TfL TransXChange XML file, accounting for walk time to the platform at Paddington and walk time from the platform to the St Pancras check-in.

Results are cached to disk by date and destination.

Connection constraints

Configurable via the search form. Defaults:

Minimum Paddington → St Pancras 50 min
Maximum Paddington → St Pancras 110 min

Valid range: 45120 min (min), 60180 min (max).

GWR fares

Walk-on single fares for Bristol Temple Meads → Paddington, selected automatically by departure time:

Ticket Price Restriction (weekdays)
Super Off-Peak £45.00 Not valid 05:0509:57
Off-Peak £63.60 Not valid before 08:26
Anytime £138.70 No restriction

Weekends always use Super Off-Peak.

Setup

pip install -e ".[dev]"

Configuration

Copy or create config/local.py (gitignored) to override defaults:

CACHE_DIR      = '/var/cache/bristol-eurostar'
CIRCLE_LINE_XML = '/path/to/output_txc_01CIR_.xml'

Defaults (in config/default.py) use ~/lib/data/tfl/.

The Circle Line XML is a TfL TransXChange timetable file. The Paddington (H&C Line) stop is 9400ZZLUPAH1; the King's Cross St Pancras stop is 9400ZZLUKSX3.

Running

flask --app app run

Then open http://localhost:5000.

Tests

pytest

License

MIT