Decorators

cached_contextmanager(func)[source]
Return type

property

cached_property(func)[source]
retry_with_proxy(*exceptions, attempts=5)[source]

When the underlying method of a grobber.stateful.Stateful object throws an exceptions that is a subtype of exceptions it reloads the grobber.request.Request and re-runs the method until it either succeeds, or the amount of retries exceeds attempts.

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.