Repository navigation
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
departureConnectionout of walking legs, such as the walk to Jambes-Est. That madeget_connectionsfail model validation.ConnectionDeparture.departure_connectionandConnectionArrival.departure_connectionare nowstr | 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 raiseValueErrorbefore 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.
InvalidRequestErrorcarries themessageof a V1 error body instead of the raw JSON. (#278)
π Updates
get_compositiontakes a validateddate(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:
datafromget_composition,line_break_characterfromget_disturbances, andalertsfromget_liveboardandget_vehicle. Passing them raisesTypeError.datawas the second positional argument ofget_composition, soget_composition("S51507", "all")now treats"all"as a date and raisesInvalid date format. Passdate=by keyword if you use it. (#278) - Stricter station and vehicle inputs raise
ValueErroras described above. - Constructing
ConnectionDepartureby position:departure_connectionmoved 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