get_category_menu

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

Get a menu of the available data classes from the specified site home URL.

This function scrapes the home web page for available dropdown classes (typically categorised hyperlinks) and returns them as a dictionary. It provides configurations to update the local catalogue file copy.

Parameters:
  • name (str) – The name of the target 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 is suppressed.

Returns:

A category menu in dictionary form, or None if retrieval failed.

Return type:

dict | None

Examples:

>>> from pyrcs.parser import get_category_menu

>>> menu: dict = get_category_menu(name='Line data')

>>> list(menu.keys())
['Line data']
>>> len(menu['Line data'])
7