Skip to main content

Simple retrying for asyncio

Project description

info:

Simple retrying for asyncio

Installation

pip install retrying-async==1.1.0 -i https://pypi.org/pypi

Usage

import asyncio

from retrying_async import retry

counter = 0

@retry(attempts=3, delay=3)
async def fn():
    global counter

    counter += 1

    if counter == 1:
        raise RuntimeError

async def main():
    await fn()

loop = asyncio.get_event_loop()

loop.run_until_complete(main())

assert counter == 2

loop.close()

Python 3.5+ is required

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

retrying-async-2.0.0.tar.gz (3.0 kB view hashes)

Uploaded Source

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