backoff
backoff copied to clipboard
Specify exceptions with specific details
First: very cool/useful package! Thanks!!
I would like to backoff/retry certain HTTP exceptions like 429, too many requests, but at the moment this isn't possible because there is only a generic requests.exceptions.HTTPError. I've looked into backoff.on_exception() and it looks like it could be extended to have something like a details parameter, maybe a dict with some keys and expected values. Does that sound doable? If so I could give it a try...
Meanwhile I've found an easier workaround by throwing my own custom exception and handling that with backoff.
You can also use the giveup keyword which allows you to inspect the exception.