get_catalogue
- pyrcs.parser.get_catalogue(url, update=False, confirmation_required=True, json_it=True, verbose=False)
Get the catalogue for a class.
- Parameters
url (str) – URL of the main page of a data cluster
update (bool) – whether to do an update check (for the package data), defaults to
False
confirmation_required (bool) – whether to confirm before proceeding, defaults to
True
json_it (bool) – whether to save the catalogue as a JSON file, defaults to
True
verbose (bool or int) – whether to print relevant information in console, defaults to
False
- Returns
catalogue in the form {‘<title>’: ‘<URL>’}
- Return type
dict or None
Examples:
>>> from pyrcs.parser import get_catalogue >>> elr_cat = get_catalogue(url='http://www.railwaycodes.org.uk/elrs/elr0.shtm') >>> type(elr_cat) dict >>> list(elr_cat.keys())[:5] ['Introduction', 'A', 'B', 'C', 'D'] >>> list(elr_cat.keys())[-5:] ['Lines without codes', 'ELR/LOR converter', 'LUL system', 'DLR system', 'Canals'] >>> line_data_cat = get_catalogue(url='http://www.railwaycodes.org.uk/linedatamenu.shtm') >>> type(line_data_cat) dict >>> list(line_data_cat.keys()) ['ELRs and mileages', 'Electrification masts and related features', 'CRS, NLC, TIPLOC and STANOX Codes', 'Line of Route (LOR/PRIDE) codes', 'Line names', 'Track diagrams']