Bridges.collect_codes¶
- Bridges.collect_codes(confirmation_required=True, verbose=False, raise_error=False)[source]¶
Collects codes of railway bridges from its source webpage.
- Parameters:
confirmation_required (bool) – Whether user confirmation is required; if
confirmation_required=True
(default), prompts the user for confirmation before proceeding with data collection.verbose (bool | int) – Whether to print relevant information in the console; defaults to
False
.raise_error (bool) – Whether to raise the provided exception; if
raise_error=False
(default), the error will be suppressed.
- Returns:
A dictionary containing railway bridge data and the date of the last update, or
None
if no data is collected.- Return type:
dict | None
Examples:
>>> from pyrcs.line_data import Bridges # from pyrcs import Bridges >>> bdg = Bridges() >>> bdg_codes = bdg.collect_codes(verbose=True) To collect data of railway bridges ? [No]|Yes: yes >>> type(bdg_codes) dict >>> list(bdg_codes.keys()) ['East Coast Main Line', 'Midland Main Line', 'West Coast Main Line', 'Scotland', 'Elizabeth Line', 'London Overground', 'Anglia', 'London Underground', 'Key to text presentation conventions'] >>> bdg_codes['Key to text presentation conventions'] {'Bold': 'Existing bridges', 'Bold italic': 'Existing locations', 'Light italic': 'Former/historical locations', 'Red': 'Stations', 'Deep red': 'Level crossings', 'Brown': 'Ventilation shafts', 'Purple': 'Junctions', 'Black,grey': 'Bridges and culverts', 'Green': 'Tunnel portals', 'Bright blue': 'Viaducts', 'Deep blue': 'Boundaries'}