I need to wait for a successful response from the server within a certain time. The easiest way to do it:
def wait_for_response():
    response = None
    time = 60
    while time > 0:
        response = requests.get(url=some_url)
        if response:
            break
        time.sleep(5)
        time -= 5
    if not response:
        print("SOME ERROR")
    return response.json()
But i don't think this solution is good. Is there any other better solution? Please note that the program should continue its work only after the function has finished its work