libb.rand_retry

rand_retry(x_times=10, exception=<class 'Exception'>)[source]

Decorator that retries function with random delays.

Useful for avoiding automated thresholding on web requests.

Parameters:
  • x_times (int) – Maximum number of retries.

  • exception – Exception type(s) to catch and retry on.

Returns:

Decorator function.