Shreyas arya

Generation

generate functionThu, 09 Feb 2023

Number of retries = 3 The total duration of all attempts doesn't exceed 10 seconds.

import time from functools import wraps def retry(f): @wraps(f) def wrapper(*args, **kwargs): exception = None for _ in range(3): try: return f(*args, **kwargs) except Exception as e: exception = e time.sleep(1) raise exception return wrapper

Questions about programming?Chat with your personal AI assistant