{"id":15439645,"url":"https://github.com/h2non/riprova","last_synced_at":"2025-08-20T06:35:18.775Z","repository":{"id":57462075,"uuid":"77256889","full_name":"h2non/riprova","owner":"h2non","description":"Versatile async-friendly retry package with multiple backoff strategies","archived":false,"fork":false,"pushed_at":"2024-01-03T21:55:16.000Z","size":141,"stargazers_count":119,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-28T13:47:43.551Z","etag":null,"topics":["async-await","asyncio","backoff","decorator","python","resiliency","resilient","retry"],"latest_commit_sha":null,"homepage":"http://riprova.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/h2non.png","metadata":{"files":{"readme":"README.rst","changelog":"History.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-24T00:03:57.000Z","updated_at":"2024-12-18T07:53:35.000Z","dependencies_parsed_at":"2024-01-03T22:44:22.173Z","dependency_job_id":null,"html_url":"https://github.com/h2non/riprova","commit_stats":{"total_commits":108,"total_committers":10,"mean_commits":10.8,"dds":"0.12962962962962965","last_synced_commit":"b719c59462d3f9cc7b064e899c2eb1a9205ae890"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/h2non/riprova","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Friprova","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Friprova/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Friprova/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Friprova/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h2non","download_url":"https://codeload.github.com/h2non/riprova/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2non%2Friprova/sbom","scorecard":{"id":451616,"data":{"date":"2025-08-11","repo":{"name":"github.com/h2non/riprova","commit":"b719c59462d3f9cc7b064e899c2eb1a9205ae890"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 4/23 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"18 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2023-120 / GHSA-45c4-8wx5-qw6w","Warn: Project is vulnerable to: PYSEC-2024-24 / GHSA-5h86-8mv2-jq9f","Warn: Project is vulnerable to: GHSA-5m98-qgg9-wh84","Warn: Project is vulnerable to: GHSA-7gpw-8wmc-pm8g","Warn: Project is vulnerable to: GHSA-8495-4g3g-x7pr","Warn: Project is vulnerable to: PYSEC-2024-26 / GHSA-8qpw-xqxj-h4r2","Warn: Project is vulnerable to: GHSA-9548-qrrj-x5pj","Warn: Project is vulnerable to: PYSEC-2023-246 / GHSA-gfw2-4jvh-wgfg","Warn: Project is vulnerable to: GHSA-pjjw-qhg8-p2p9","Warn: Project is vulnerable to: PYSEC-2023-250 / GHSA-q3qx-c6g2-7pw2","Warn: Project is vulnerable to: PYSEC-2023-251 / GHSA-qvrw-v9rv-5rjx","Warn: Project is vulnerable to: PYSEC-2021-76 / GHSA-v6wp-4m6f-gcjg","Warn: Project is vulnerable to: PYSEC-2023-247 / GHSA-xx9p-xxvh-7g8j","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg","Warn: Project is vulnerable to: PYSEC-2022-43017 / GHSA-qwmp-2cf2-g9g6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T08:19:07.189Z","repository_id":57462075,"created_at":"2025-08-19T08:19:07.189Z","updated_at":"2025-08-19T08:19:07.189Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271278994,"owners_count":24731900,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["async-await","asyncio","backoff","decorator","python","resiliency","resilient","retry"],"created_at":"2024-10-01T19:08:22.018Z","updated_at":"2025-08-20T06:35:18.742Z","avatar_url":"https://github.com/h2non.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"riprova |PyPI| |Coverage Status| |Documentation Status| |Quality| |Versions|\n============================================================================\n\n``riprova`` (meaning ``retry`` in Italian) is a small, general-purpose and versatile `Python`_ library\nthat provides retry mechanisms with multiple backoff strategies for any sort of failed operations.\n\nIt's domain agnostic, highly customizable, extensible and provides a minimal API that's easy to instrument in any code base via decorators, context managers or raw API consumption.\n\nFor a brief introduction about backoff mechanisms for potential failed operations, `read this article`_.\n\n\nFeatures\n--------\n\n-  Retry decorator for simple and idiomatic consumption.\n-  Simple Pythonic programmatic interface.\n-  Maximum retry timeout support.\n-  Supports error `whitelisting`_ and `blacklisting`_.\n-  Supports custom `error evaluation`_ retry logic (useful to retry only in specific cases).\n-  Automatically retry operations on raised exceptions.\n-  Supports `asynchronous coroutines`_ with both ``async/await`` and ``yield from`` syntax.\n-  Configurable maximum number of retry attempts.\n-  Highly configurable supporting max retries, timeouts or retry notifier callback.\n-  Built-in backoff strategies: constant, `fibonacci`_ and `exponential`_ backoffs.\n-  Supports sync/async context managers.\n-  Pluggable custom backoff strategies.\n-  Lightweight library with almost zero embedding cost.\n-  Works with Python +2.6, 3.0+ and PyPy.\n\n\nBackoff strategies\n------------------\n\nList of built-in backoff strategies.\n\n- `Constant backoff`_\n- `Fibonacci backoff`_\n- `Exponential backoff`_\n\nYou can also implement your own one easily.\nSee `ConstantBackoff`_ for an implementation reference.\n\n\nInstallation\n------------\n\nUsing ``pip`` package manager (requires pip 1.9+. Upgrade it running: ``pip install -U pip``):\n\n.. code-block:: bash\n\n    pip install -U riprova\n\nOr install the latest sources from Github:\n\n.. code-block:: bash\n\n    pip install -e git+git://github.com/h2non/riprova.git#egg=riprova\n\n\nAPI\n---\n\n- riprova.retry_\n- riprova.Retrier_\n- riprova.AsyncRetrier_\n- riprova.Backoff_\n- riprova.ConstantBackoff_\n- riprova.FibonacciBackoff_\n- riprova.ExponentialBackoff_\n- riprova.ErrorWhitelist_\n- riprova.ErrorBlacklist_\n- riprova.add_whitelist_error_\n- riprova.RetryError_\n- riprova.RetryTimeoutError_\n- riprova.MaxRetriesExceeded_\n- riprova.NotRetriableError_\n\n\n.. _riprova.retry: http://riprova.readthedocs.io/en/latest/api.html#riprova.retry\n.. _riprova.Retrier: http://riprova.readthedocs.io/en/latest/api.html#riprova.Retrier\n.. _riprova.AsyncRetrier: http://riprova.readthedocs.io/en/latest/api.html#riprova.AsyncRetrier\n.. _riprova.Backoff: http://riprova.readthedocs.io/en/latest/api.html#riprova.Backoff\n.. _riprova.ConstantBackoff: http://riprova.readthedocs.io/en/latest/api.html#riprova.ConstantBackoff\n.. _riprova.FibonacciBackoff: http://riprova.readthedocs.io/en/latest/api.html#riprova.FibonacciBackoff\n.. _riprova.ExponentialBackoff: http://riprova.readthedocs.io/en/latest/api.html#riprova.ExponentialBackoff\n.. _riprova.ErrorWhitelist: http://riprova.readthedocs.io/en/latest/api.html#riprova.ErrorWhitelist\n.. _riprova.ErrorBlacklist: http://riprova.readthedocs.io/en/latest/api.html#riprova.ErrorBlacklist\n.. _riprova.add_whitelist_error: http://riprova.readthedocs.io/en/latest/api.html#riprova.add_whitelist_error\n.. _riprova.RetryError: http://riprova.readthedocs.io/en/latest/api.html#riprova.RetryError\n.. _riprova.RetryTimeoutError: http://riprova.readthedocs.io/en/latest/api.html#riprova.RetryTimeoutError\n.. _riprova.MaxRetriesExceeded: http://riprova.readthedocs.io/en/latest/api.html#riprova.MaxRetriesExceeded\n.. _riprova.NotRetriableError: http://riprova.readthedocs.io/en/latest/api.html#riprova.NotRetriableError\n\n\nExamples\n^^^^^^^^\n\nYou can see more featured examples from the `documentation` site.\n\n**Basic usage examples**:\n\n.. code-block:: python\n\n    import riprova\n\n    @riprova.retry\n    def task():\n        \"\"\"Retry operation if it fails with constant backoff (default)\"\"\"\n\n    @riprova.retry(backoff=riprova.ConstantBackoff(retries=5))\n    def task():\n        \"\"\"Retry operation if it fails with custom max number of retry attempts\"\"\"\n\n    @riprova.retry(backoff=riprova.ExponentialBackOff(factor=0.5))\n    def task():\n        \"\"\"Retry operation if it fails using exponential backoff\"\"\"\n\n    @riprova.retry(timeout=10)\n    def task():\n        \"\"\"Raises a TimeoutError if the retry loop exceeds from 10 seconds\"\"\"\n\n    def on_retry(err, next_try):\n        print('Operation error: {}'.format(err))\n        print('Next try in: {}ms'.format(next_try))\n\n    @riprova.retry(on_retry=on_retry)\n    def task():\n        \"\"\"Subscribe via function callback to every retry attempt\"\"\"\n\n    def evaluator(response):\n        # Force retry operation if not a valid response\n        if response.status \u003e= 400:\n            raise RuntimeError('invalid response status')  # or simple return True\n        # Otherwise return False, meaning no retry\n        return False\n\n    @riprova.retry(evaluator=evaluator)\n    def task():\n        \"\"\"Use a custom evaluator function to determine if the operation failed or not\"\"\"\n\n    @riprova.retry\n    async def task():\n        \"\"\"Asynchronous coroutines are also supported :)\"\"\"\n\n\n**Retry failed HTTP requests**:\n\n.. code-block:: python\n\n    import pook\n    import requests\n    from riprova import retry\n\n    # Define HTTP mocks to simulate failed requests\n    pook.get('server.com').times(3).reply(503)\n    pook.get('server.com').times(1).reply(200).json({'hello': 'world'})\n\n\n    # Retry evaluator function used to determine if the operated failed or not\n    def evaluator(response):\n        if response != 200:\n            return Exception('failed request')  # you can also simply return True\n        return False\n\n\n    # On retry even subscriptor\n    def on_retry(err, next_try):\n        print('Operation error {}'.format(err))\n        print('Next try in {}ms'.format(next_try))\n\n\n    # Register retriable operation\n    @retry(evaluator=evaluator, on_retry=on_retry)\n    def fetch(url):\n        return requests.get(url)\n\n\n    # Run task that might fail\n    fetch('http://server.com')\n\n\n\nLicense\n-------\n\nMIT - Tomas Aparicio\n\n.. _exponential: https://en.wikipedia.org/wiki/Exponential_backoff\n.. _fibonacci: https://en.wikipedia.org/wiki/Fibonacci_number\n.. _asyncio: https://docs.python.org/3.5/library/asyncio.html\n.. _Python: http://python.org\n.. _annotated API reference: https://h2non.github.io/paco\n.. _async/await: https://www.python.org/dev/peps/pep-0492/\n.. _yield from: https://www.python.org/dev/peps/pep-0380/\n.. _documentation: http://riprova.readthedocs.io/en/latest/examples.html\n.. _read this article: http://dthain.blogspot.ie/2009/02/exponential-backoff-in-distributed.html\n.. _Constant backoff: http://riprova.readthedocs.io/en/latest/api.html#riprova.ConstantBackoff\n.. _Fibonacci backoff: http://riprova.readthedocs.io/en/latest/api.html#riprova.FibonacciBackoff\n.. _Exponential backoff: http://riprova.readthedocs.io/en/latest/api.html#riprova.ExponentialBackOff\n.. _ConstantBackoff: https://github.com/h2non/riprova/blob/master/riprova/strategies/constant.py\n.. _whitelisting: https://github.com/h2non/riprova/blob/master/examples/whitelisting_errors.py\n.. _blacklisting: https://github.com/h2non/riprova/blob/master/examples/blacklisting_errors.py\n.. _error evaluation: https://github.com/h2non/riprova/blob/master/examples/http_request.py\n.. _asynchronous coroutines: https://github.com/h2non/riprova/blob/master/examples/http_asyncio.py\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/riprova.svg?maxAge=2592000?style=flat-square\n   :target: https://pypi.python.org/pypi/riprova\n.. |Coverage Status| image:: https://coveralls.io/repos/github/h2non/riprova/badge.svg?branch=master\n   :target: https://coveralls.io/github/h2non/riprova?branch=master\n.. |Documentation Status| image:: https://img.shields.io/badge/docs-latest-green.svg?style=flat\n   :target: http://riprova.readthedocs.io/en/latest/?badge=latest\n.. |Quality| image:: https://codeclimate.com/github/h2non/riprova/badges/gpa.svg\n   :target: https://codeclimate.com/github/h2non/riprova\n.. |Stability| image:: https://img.shields.io/pypi/status/riprova.svg\n   :target: https://pypi.python.org/pypi/riprova\n.. |Versions| image:: https://img.shields.io/pypi/pyversions/riprova.svg\n   :target: https://pypi.python.org/pypi/riprova\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2non%2Friprova","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh2non%2Friprova","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2non%2Friprova/lists"}