get_category_menu

pyrcs.parser.get_category_menu(name, update=False, confirmation_required=True, verbose=False, raise_error=False)[source]

Gets a menu of the available classes from the specified URL.

This function scrapes a web page for available classes (typically categorised hyperlinks) and returns them as a dictionary. It also provides options to update the catalogue and save it as a JSON file.

Parameters:
  • name (str) – The name of the data category.

  • update (bool) – Whether to check for updates to the package data; defaults to False.

  • confirmation_required (bool) – Whether user confirmation is required before proceeding; defaults to True.

  • verbose (bool | int) – Whether to print relevant information to 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 category menu in dictionary form, where keys are data cluster names and values are URLs.

Return type:

dict | None

Examples:

>>> from pyrcs.parser import get_category_menu
>>> menu = get_category_menu(name='Line data')
>>> type(menu)
dict
>>> list(menu.keys())
['Line data']
>>> len(menu['Line data'])
7