RetryConfig

pydoll · automation, retry-logic, backoff-strategy, error-handling, resilience

Configures retry behavior for operations, including max attempts, delay, backoff, and exception matching, enabling resilient automation.

# Source: https://github.com/autoscrape-labs/pydoll | License: MIT | Copyright 2025 AutoscrapeLabs
# Provided via justclaw.it.com; keep this notice with the code.
class RetryConfig:
    def __init__(
        self,
        max_retries: int = 5,
        exceptions: Union[Type[Exception], List[Type[Exception]]] = Exception,
        on_retry: Optional[Callable] = None,
        delay: float = 0,
        exponential_backoff: bool = False,
    ):
        self.max_retries = max_retries
        self.exceptions = exceptions
        self.on_retry = on_retry
        self.delay = delay
        self.exponential_backoff = exponential_backoff

    def calculate_delay(self, attempt: int) -> float:
        if not self.delay:
            return 0
        return self.delay * (2**attempt if self.exponential_ba

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key