import requests
import time


def get_with_retry(uri, max_retry=5):
    """Wrapper for requests.get() to retry

    Args:
        uri (str): URI to request
        max_retry (int): number of retries to make

    Returns:
        the requests response
    """
    r = requests.get(uri)
    k = 0
    while r.status_code != 200:
        if k == max_retry:
            print(f"{uri} failed.")
            break
        time.sleep(1)
        r = requests.get(uri)
        k += 1

    return r