import requests


def get_page_from_url(url, retries=5):
    """
    This function simply uses "requests" to get the contents of a given url,
    it will try "retries" times before returning None.
    """

    while retries:
        try:
            page = requests.get(url, headers={"User-agent": "your bot 0.1"})
            page.raise_for_status()
        except requests.exceptions.ConnectionError as e:
            retries -= 1
            print(f"ConnectionError occurred, retries left = {retries}")
        else:
            # No exception occurred, return page object
            return page

    return None