visch
01/12/2022, 6:00 PMvisch
01/12/2022, 6:04 PMdef fatal_code(e):
return 400 <= e.response.status_code < 500
@backoff.on_exception(backoff.expo,
requests.exceptions.RequestException,
max_time=300,
raise_on_giveup=False,
giveup=fatal_code)
def get_url(url):
return requests.get(url)
from https://github.com/litl/backoff
specifically raise_on_giveup
is what I want to be False, but I only want it sometimes.
----
(Specifically for the SDK there's the decorator that @edgar_ramirez_mondragon wrote)
https://gitlab.com/meltano/sdk/-/blob/main/singer_sdk/streams/rest.py#L163 that makes this one attractive if I could make it work