Decorators¶
-
retry_with_proxy
(*exceptions, attempts=5)[source]¶ When the underlying method of a
grobber.stateful.Stateful
object throws an exceptions that is a subtype ofexceptions
it reloads thegrobber.request.Request
and re-runs the method until it either succeeds, or the amount of retries exceedsattempts
.Example:
When calling the
Key.get_key
method it will re-run when it raises a KeyError.class Key(Stateful): @retry_with_proxy(KeyError) async def get_key(): data = await self._req.json return data["key"]
- Returns
Decorator which applies the retry logic to the decorated method.