get_category_menu¶
-
pyrcs.utils.
get_category_menu
(menu_url, update=False, confirmation_required=True, json_it=True, verbose=False)[source]¶ Get a menu of the available classes.
- Parameters
menu_url (str) – URL of the menu page
update (bool) – whether to check on update and proceed to update the package data, defaults to
False
confirmation_required (bool) – whether to prompt a message for confirmation to proceed, 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 as the function runs, defaults to
False
- Returns
a category menu
- Return type
dict or None
Example:
>>> from pyrcs.utils import get_category_menu >>> url = 'http://www.railwaycodes.org.uk/linedatamenu.shtm' >>> menu = get_category_menu(url) >>> type(menu) <class 'dict'> >>> print(list(menu.keys())) ['Line data']