title: Requests with retries
body: <p>I'm trying to make requests retry if the response status code is not 200, so I wrote this function:</p>
  
  <pre><code>    def _get_resource(url, max_retries=0, delay=0):
           number_retries = 0
           response = requests.get(url)
           while response.status_code != 200 and number_retries &lt; max_retries:
              time.sleep(delay)
              response = requests.get(url)
              number_retries += 1
          response.raise_for_status()
          return response.content
  </code></pre>
  
  <p>Any suggestions to improve it?</p>