I have a problem waiting for a response 200. When I perform my get request the expected resource isn't there and the response is 204. What I want to do is wait for two minutes and lets say call every 10 seconds to check is the response is 200. If time is out, I want to return an error.
def waitForResourceAvailable(response):
while response.status_code == 204:
time.sleep(10)
if response.status_code == 200:
break
This works well, but I need a solution to exit the loop in case of status code 200 not to appear in a specified time.
responseis fixed; neither it nor any part of it is going to change in the code you show. You have to repeat the request if you want a different response.