Created
March 6, 2015 19:46
-
-
Save ssbb/810c9052d4fde6c78e1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import decorator | |
def retry(times, *exception_types): | |
@decorator.decorator | |
def try_it(func, *fargs, **fkwargs): | |
for i in xrange(times): | |
try: | |
return func(*fargs, **fkwargs) | |
except exception_types or Exception: | |
pass | |
return try_it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment