dsci524_group29_webscraping.fetch_html ====================================== .. py:module:: dsci524_group29_webscraping.fetch_html Functions --------- .. autoapisummary:: dsci524_group29_webscraping.fetch_html.fetch_html Module Contents --------------- .. py:function:: fetch_html(url, timeout=10) Fetches the HTML content of a given URL. :param url: The URL of the webpage to fetch. :type url: str :param timeout: The maximum time to wait for a response, in seconds. Defaults to 10 seconds. :type timeout: int, optional :returns: The raw HTML content of the webpage if the request is successful. :rtype: str :raises ValueError: If the URL provided is invalid or improperly formatted. :raises requests.exceptions.Timeout: If the request times out before receiving a response. :raises requests.exceptions.RequestException: For other issues during the HTTP request, such as connectivity problems or a non-success HTTP status code. .. rubric:: Examples Fetch the HTML content of a webpage: >>> html_content = fetch_html("https://example.com") >>> print(html_content[:100]) # Prints the first 100 characters of the HTML content .. rubric:: Notes - This function uses the `requests` library to perform an HTTP GET request. - Ensure the `requests` library is installed before using this function.