retrying处理Python异常
https://mp.weixin.qq.com/s/j9vqFQxVIKgECnE0N-bD9A
import random
from retrying import retry
@retry(stop_max_attempt_number=5)
def do_something_unreliable():
if random.randint(0, 10) > 1:
print("just have a test")
raise IOError("raise exception!")
else:
return "good job!"
print(do_something_unreliable())