Retry your functions later, asynchronously
Project description
retry_later
@retry_later
allows you to execute a function asynchronously in the background and automatically retry it if an exception occurs, up to a specified maximum number of retries.
Why?
For example, you can retry sending an email until it's actually sent.
Installation
For now git clone
or copy the retry_later
folder. Will be working on it more.
Usage
Simply add @retry_later
to your function. This also works with async
functions.
from my_very_python_real_email_client import send_mail_to_friend, send_text_to_friend
# Import the decorator
from retry_later import retry_later
@retry_later(retry_interval=10, max_retries=5, exception=ConnectionError)
def send_email():
send_mail_to_friend(email="veryrealperson@veryrealemail.haha", body="hi!")
@retry_later(retry_interval=10, max_retries=5, exception=ConnectionError)
async def send_a_text():
await send_text_to_friend(number="+123456789", body="hi! texting you")
send_email()
asyncio.run(send_a_text())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
retry_later-0.0.1.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for retry_later-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6dc7deb11e78c3f147d0614a9c8b3aa8b0a8abc394f14c1ac4f509364eeaf60 |
|
MD5 | cfa2a7df5d9a1c22b51e52b1bfe851ba |
|
BLAKE2b-256 | 07726f7d55b4b29bba78e4cd328a03852aec417e3d35d053a2f1e1c9ef17b65c |