tenacity
tenacity copied to clipboard
Retrying library for Python
Hello, is it possible to call another function before retrying? I have a try and except block, and I know that if it fails it is because of a connection...
Fixes #249 #412 Second PR after breaking down https://github.com/jd/tenacity/pull/433 (follows https://github.com/jd/tenacity/pull/434) - First PR https://github.com/jd/tenacity/pull/434 - Third PR https://github.com/hasier/tenacity/pull/2 After [DRYing the `iter()` function](https://github.com/jd/tenacity/pull/434), make `AsyncRetrying` support `async` callbacks. Supersedes...
This PR makes it easier to mock sleeping when retrying asynchronous functions, using the same approach as was done for synchronous functions in #236. Example usage: ```python @retry(wait=wait_fixed(9999999)) def function_with_retry():...
I'm trying to update MyPy version in Airflow to 1.8.0, but I'm getting a strange error when I run it on this code: ```python def run_with_advanced_retry(self, _retry_args: dict[Any, Any], *args:...
## Goal A context manager that retries if the `__enter__` method of a context manager raises an exception, but does NOT retry when the contents of the `with` block raises...
# Summary Improves wait_exponential_jitter to inherit wait_exponential - Reuses `wait_exponential.__call__` method instead of of duplicating code - Follows argument names of wait_exponential - Adds `min` argument - Supports supplying `max`,...
# Summary Respects `min` argument for `wait_random_exponential` - currently, `min` argument only affects computing the `high` range of the uniform sampling - `min` does not affect the `low` range of...
The `before_sleep_log` messages shows the amount of seconds until retry to 15 decimal places. The [`after_log`](https://github.com/jd/tenacity/blob/99e7482e8b027f0521315e0f7830a0badae5c561/tenacity/after.py#L31) function rounds the number of seconds to 3 decimals. The [`before_sleep_log`](https://github.com/jd/tenacity/blob/99e7482e8b027f0521315e0f7830a0badae5c561/tenacity/before_sleep.py#L31) function should do...
Hi, I'm a new user and I'm really impressed with your library. I recently encountered an issue while using your library and attempting to modify function arguments on the fly...
async `functools.singledispatch` or `functools.singledispatchmethod` decorated functions are not retried using tenacity: ```python import asyncio import tenacity from functools import singledispatch @tenacity.retry( retry=tenacity.retry_if_exception_type(RuntimeError), stop=tenacity.stop_after_attempt(2), ) @singledispatch async def foo(a: str): raise...