title: How to wait for a specific http response in python
body: <p>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.</p>
  
  <pre><code>def waitForResourceAvailable(response):
      while response.status_code == 204:
          time.sleep(10)
          if response.status_code == 200:
              break
  </code></pre>
  
  <p>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.</p>