{"id":15297469,"url":"https://github.com/nerandell/async_retrial","last_synced_at":"2025-04-13T22:52:06.961Z","repository":{"id":57412262,"uuid":"37901579","full_name":"nerandell/async_retrial","owner":"nerandell","description":"Python package for retrial of asyncio based coroutines","archived":false,"fork":false,"pushed_at":"2023-03-14T11:33:59.000Z","size":20,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T13:11:11.370Z","etag":null,"topics":["asynchronous","asyncio","python-3","retries"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nerandell.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-23T06:33:27.000Z","updated_at":"2025-03-17T15:41:25.000Z","dependencies_parsed_at":"2022-08-28T01:11:15.965Z","dependency_job_id":null,"html_url":"https://github.com/nerandell/async_retrial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerandell%2Fasync_retrial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerandell%2Fasync_retrial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerandell%2Fasync_retrial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerandell%2Fasync_retrial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nerandell","download_url":"https://codeload.github.com/nerandell/async_retrial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248794561,"owners_count":21162614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","asyncio","python-3","retries"],"created_at":"2024-09-30T19:17:46.469Z","updated_at":"2025-04-13T22:52:06.941Z","avatar_url":"https://github.com/nerandell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Retrial library for asyncio coroutines\n======================================\n.. image:: https://travis-ci.org/nerandell/async_retrial.svg?branch=master\n    :target: https://travis-ci.org/nerandell/async_retrial\n\nEasy to use retry library based on asyncio_\n\n.. _asyncio: https://docs.python.org/3/library/asyncio.html\n\nRequirements\n------------\n- Python \u003e= 3.3\n- asyncio https://pypi.python.org/pypi/asyncio\n\nInstallation\n------------\n\nTo install via pip\n\n.. code-block:: bash\n\n    $ pip install async_retrial\n    \nTo install from source\n\n.. code-block:: bash\n\n    $ git clone https://github.com/nerandell/async_retrial\n    $ cd async_retrial\n    $ python setup.py install\n\nExamples\n--------\n\nYou can either use ``RetryHandler`` or ``retry`` decorator\n\n``retry`` decorator\n\n.. code-block:: python\n\n    def retry(should_retry_for_result=_default_retry_for_result, \n              should_retry_for_exception=_default_retry_for_exception,\n              multiplier=2, timeout=None, max_attempts=None, strategy=None):\n                \"\"\"\n        :param should_retry_for_result: A function that is called with argument as result to allow retrial for specific\n                                        set of results. Must return a boolean value\n        :param should_retry_for_exception: A function that is called if the function to be retried threw an exception \n                                           allow retrial for specific set of exceptions. Must return a boolean value\n        :param multiplier: Must be an integer value, If defined, the retrial would be exponential with this behind the \n                           multiplier\n        :param timeout: If defined, the function will be retried if no result was returned in this time.\n        :param max_attempts: Max number of attempts to retry\n        :param strategy: Must be a list of integers. If defined, retrial would follow this strategy. For ex. if strategy \n                         is [1,3,5,8,11], function would be retried at 1, 3, 5, 8, 11, 11, 11, ... seconds\n        :return:\n        \"\"\"\n\nTo use the decorator:\n\n.. code-block:: python\n\n    from retrial.retrial import retry\n    \nUsing different settings:\n\n.. code-block:: python\n\n    @retry()\n    def my_function(*args, **kwargs):\n        '''Retry till successful. Default multiplier is 2'''\n        \n    @retry(multiplier=3)\n    def my_function(*args, **kwargs):\n        '''Retry at 0, 3, 9, 27, 81 ... seconds until successful'''\n        \n    @retry(strategy=[1, 1, 2, 3, 5, 8, 13])\n    def my_function(*args, **kwargs):\n        '''Retry at 1, 1, 2, 3, 5, 8, 13, 13, 13 ... seconds until successful''' \n        \n    @retry(max_attempts=3)\n    def my_function(*args, **kwargs):\n        '''Retry for a maximum of 3 times'''\n    \n    @retry(should_retry_for_result=lambda x: x \u003c 0)\n    def my_function(*args, **kwargs):\n        '''Retry if result is negative value'''\n    \n    @retry(should_retry_for_exception=lambda x: isinstance(x, KeyError))\n    def my_function(*args, **kwargs):\n        '''Retry if exception was of type KeyError'''\n\nLicense\n-------\n``async_retrial`` is offered under the MIT license.\n\nSource code\n-----------\nThe latest developer version is available in a github repository:\nhttps://github.com/nerandell/async_retrial\n        \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerandell%2Fasync_retrial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerandell%2Fasync_retrial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerandell%2Fasync_retrial/lists"}