I am using the following snippet(please note, only partial snippets shown):
from urllib3.util import Retry
status_forcelist = (500, 502, 504)
retry = Retry(
total=retries,
read=retries,
connect=retries,
backoff_factor=backoff_factor,
status_forcelist=status_forcelist,
method_whitelist=frozenset(['GET', 'POST'])
As of now, the retry would be done for status codes 500
,502
,504
. However, I intend to retry for any status code but not 400
. Is there a graceful way to achieve this instead of populating/hardcoding the status_forcelist
for all status codes ?