Skip to content

πŸš† pyRail v0.7.0 – Walking Legs, Input Checks & Updated iRail Docs

Latest

Choose a tag to compare

@tjorim tjorim released this 25 Nov 16:38
· 3 commits to main since this release
33df613

pyRail 0.7.0 aligns the client with the updated iRail docs, fixes journeys that include a walking leg, and rejects inputs that cannot name a station before they reach the API. This release contains small breaking changes (see below). It is the last release before the optional CDN backend (Linked Connections), which will arrive in a beta.

πŸš€ What's Changed

πŸ› Fixes

  • Journeys with a walking leg no longer fail. The iRail API leaves departureConnection out of walking legs, such as the walk to Jambes-Est. That made get_connections fail model validation. ConnectionDeparture.departure_connection and ConnectionArrival.departure_connection are now str | None. (#291, #290)
  • Cleaner iRail logs. Station names and vehicle ids that are empty, longer than 72 characters, or hold a control character or one of % | { } [ ] now raise ValueError before a request is sent. Home Assistant sometimes passed unrendered templates as station names, which iRail asked us to stop sending. No real station name is affected: the longest is 41 characters. (#292, #10)
  • Coordinate validation. A station or vehicle with a longitude outside Β±180 or a latitude outside Β±90 now fails with InvalidResponseError. (#292, #27)
  • Clearer 400 errors. InvalidRequestError carries the message of a V1 error body instead of the raw JSON. (#278)

πŸ”„ Updates

  • get_composition takes a validated date (DDMMYY). (#278)
  • README: notes the planned iRail API switch-off. (#267)
  • Dependency, CI and tooling updates.

Breaking changes

  • Removed request parameters that the iRail docs no longer list: data from get_composition, line_break_character from get_disturbances, and alerts from get_liveboard and get_vehicle. Passing them raises TypeError. data was the second positional argument of get_composition, so get_composition("S51507", "all") now treats "all" as a date and raises Invalid date format. Pass date= by keyword if you use it. (#278)
  • Stricter station and vehicle inputs raise ValueError as described above.
  • Constructing ConnectionDeparture by position: departure_connection moved to the end of the fields. Parsing API responses is unaffected.

Upgrading to 0.7.0

# Before
await api.get_composition("S51507", "all")
await api.get_liveboard(station_id="BE.NMBS.008813003", alerts=True)

# After
await api.get_composition("S51507")
await api.get_liveboard(station_id="BE.NMBS.008813003")

πŸ“œ Full Changelog: v0.6.1...v0.7.0