title: Python tenacity: How do I retry a function without raising an exception if all retries fail?
body: <p>let's say I have the following function:</p>
  <pre><code>@retry(stop=stop_after_attempt(3))
  def foo():
    try:
      response = requests.post(...)
      response.raise_for_status()
      return response
    except Exception as e:
      raise e
  </code></pre>
  <p>This function will retry 3 times, and if all three retries fail, an exception will be raised.</p>
  <p>How can I use tenacity to do 3 retries without raising the exception? Something like:</p>
  <pre><code>@retry(stop=stop_after_attempt(3))
  def foo(ignore_errors=False):
    try:
      response = requests.post(...)
      response.raise_for_status()
      return response
    except Exception as e:
      if ignore_errors and function has been retried three times:
        pass
      raise e
  </code></pre>