import requests
from bs4 import BeautifulSoup


def get_url_paths(url, ext='ff'):
    """
    Function to obtain the list of elements in ``url``.

    Parameters
    -------------
    url : `str`
        Path to the Internet address.

    ext : `str`, optional
        File extension to search for. This variable is set to ``ff`` by
        default.

    Returns
    ----------
    parent_arr : list
        List of files in ``url`` that match ``ext`` extension.
    """
    # Connecting to `url`
    response = requests.get(url)
    # Checking connection
    if response.ok:
        response_text = response.text
    else:
        return response.raise_for_status()
    # Parsing HTML from website
    soup = BeautifulSoup(response_text, 'html.parser')
    # Extracting filenames that match the criteria of `ext`.
    parent = [url + node.get('href') for node in soup.find_all('a') if node.get('href').endswith(ext)]

    return parent