Tenacity is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything. It originates from a fork of retrying which is sadly no longer maintained. Tenacity isn't api compatible with retrying but adds significant new functionality and fixes a number of longstanding bugs.
Questions tagged [python-tenacity]
20 questions
1
vote
1 answer
Python3 retrying with tenacity (w/out decorators) gives error claiming "missing arguments" when using gspread
I'm trying to use the tenacity module to avoid frequent requesting errors (APIErrors) from gspread. I understand the common examples of tenacity use decorators, but I want to use tenacity's Retrying() function so I can have it retry gspread's…

Kyle Carow
- 74
- 9
1
vote
4 answers
Referencing self in decorator
I am implementing a database connector class in python. I will use the retry decorator from tenacity library to retry the connection of database when it times out.
I want to pass the self.retry_count and self.retry_interval to the arguments in retry…

Kevin Lee
- 401
- 3
- 9
- 22
1
vote
2 answers
Can I dynamically change the arguments passed to a function when retrying with Tenacity?
I'd like to make use of the Tenacity Python library for its @retry decorator. However, I want to call my function with different parameters on each retry, and am not sure how to specify that.
My function definition looks something like this:
from…

soapergem
- 9,263
- 18
- 96
- 152
0
votes
1 answer
Disable Tenacity for loop `for attempt in Retrying` in unit tests
I am writing unit tests and want to disable tenacity, I've previously been able to disable tenacity when its a decorator ie:
@retry(stop=stop_after_attempt(3),wait=wait_fixed(5))
def function_that_retries(param) -> None:

Mia Altieri
- 19
- 1
- 4
0
votes
1 answer
python retry with retrying, disable for unittest
EDIT: Since tenacity is a more recent for of retrying, this question can be considered a duplicate of the linked question, with the solution being to upgrade to tenacity.
Similar to this question, I want to unittest a function in python that has a…

tkruse
- 10,222
- 7
- 53
- 80