You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
442 B
19 lines
442 B
from functools import wraps
|
|
|
|
|
|
def retry(name='name', for_word=3):
|
|
def decorator(func):
|
|
@wraps(func)
|
|
def wrapper(*args, **kwargs):
|
|
for i in range(for_word):
|
|
try:
|
|
res = func(*args, **kwargs)
|
|
|
|
return res
|
|
except Exception as e:
|
|
print(f'[{name}]:{e}')
|
|
return False
|
|
|
|
return wrapper
|
|
|
|
return decorator
|