I'm using requests get, and fairly often an exception is raised (json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)). I want to loop until it's successful, and not discriminate on the exception type (yet). My code will either succeed first time (exit the loop) or keep looping indefinitely.
def loop_json(self,url):
    result = None
    print(url)
    while result == None:
        try:
            print('trying')
            response = requests.get(url).json()
            result = 1
        except:
            time.sleep(3)
            pass
    return response
