using the retrying package. How do I use it for retrying, and if the retries ends without a successful match, the code block leaves?
import random
from retrying import retry
@retry(wait_fixed=500, stop_max_delay=5000 )
def do_something_unreliable():
result = random.randint(0, 10)
print result
if result != 11:
raise IOError("Broken")
else:
return True
print do_something_unreliable()
I want the the raise IOError to be replaced with an option of returning, say, False
In other words, I want to use this decorator, in case of actual values is different than expected, while the actual is created frequently from other function
using the retrying package. How do I use it for retrying, and if the retries ends without a successful match, the code block leaves?
I want the the raise IOError to be replaced with an option of returning, say, False
In other words, I want to use this decorator, in case of actual values is different than expected, while the actual is created frequently from other function