Comments (1)
def wait_if_retry_after(retry_state: RetryCallState) -> float:
exc = retry_state.outcome.exception()
if isinstance(exc, TelegramRetryAfter):
logging.debug(f'{exc.__class__.__name__} {exc.retry_after=}')
return exc.retry_after
retry_telegram_method = retry(
stop=stop_after_attempt(3),
retry=(
retry_if_exception_cause_type(TelegramAPIError) |
retry_if_not_exception_type(TelegramBadRequest)
),
before_sleep=before_sleep_log(logging.getLogger(), logging.DEBUG),
after=after_log(logging.getLogger(), logging.DEBUG),
wait=wait_if_retry_after
)
from tenacity.
Related Issues (20)
- wait with proportional, but limited, jitter
- how do i get the type of the exception raised within a retry? HOT 1
- Add type overloads for async `sleep` function
- Question: how do I use an instance method for the retry_error_callback?
- Retry strategies need to be explicitly exported for type checkers
- `before_log` doesn't accept LoggerAdapter - mypy HOT 2
- When using multiple @retry decorators on a function, inner decorator's state is constantly reset HOT 1
- Bunch of effects disppeared from the "Effect" list HOT 1
- Can tenacity be used to retry on code http error ? HOT 1
- Passing an async function to before/after handler? HOT 2
- Getting error message from retry_state.outcome results in program termination. HOT 4
- More safe defaults HOT 3
- bug: `retry_if_exception_message` only checks the beginning of the string HOT 2
- RFE: is it possible to start making github releases?🤔 HOT 2
- Don't allow passing in loguru HOT 1
- question: when to initialize the `'delay_since_first_attempt'` key
- How to union two `retry_if`? HOT 1
- `before_sleep_log` logs "<unknown>" HOT 5
- MyPy 1.8.0 don't recognize `tenacity.Retrying()` as a callable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tenacity.