Skip to main content

Retry your functions later, asynchronously

Project description

latest tests

retry_later

@retry_later allows you to retry the execution of a function asynchronously in the background until it's done.

Why?

For example, you can retry sending an email until it's sent.

Installation

pip install retry-later

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.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

retry_later-0.0.2-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page