Coder Social home page Coder Social logo

doruirimescu / exception-with-retry Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 51 KB

Wraps an exception-throwing function and retries with delay. If unsuccessful, it finally throws the original exception.

Home Page: https://pypi.org/project/exception-with-retry/

License: MIT License

Python 100.00%
python python3 exception wrapper

exception-with-retry's Introduction

exception-with-retry

Pipeline status

Wraps any method which throws exceptions. Retries calls when exceptions are thrown. Available on PyPI and installable via pip. Don't forget to star the project!

Description

  • Check the unit tests for usage.
  • Build and run tests locally: tox
  • Publish to test pypi: tox -e clean && tox -e build && tox -e publish
  • Publish to pypi:
    • git tag MAJOR.MINOR[.PATCH]
    • tox -e clean && tox -e build
    • tox -e publish -- --repository pypi

Example usage:

@exception_with_retry(n_retry=3, sleep_time_s=1.5)
def wrapped_method(number_1: int, number_2: int = 0, calls: List = []):
    calls.append(1)
    if number_1 < 0:
        raise Exception("Not going to happen")
    else:
        return number_1 + number_2

Making Changes & Contributing

This project uses pre-commit, please make sure to install it before making any changes::

pip install pre-commit
cd exception-with-retry
pre-commit install

It is a good idea to update the hooks to the latest version::

pre-commit autoupdate

Don't forget to tell your contributors to also install and use pre-commit.

Note

This project has been set up using PyScaffold 4.0.2. For details and usage information on PyScaffold see https://pyscaffold.org/.

exception-with-retry's People

Contributors

doruirimescu avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.