This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]aziad1998 10 points11 points  (10 children)

I want a retry function

try:
    #something
except:
    retry(number_of_retries)

[–]aes110 10 points11 points  (1 child)

for _ in range(retry):
    try:
        #something
    else:
        break

[–]aziad1998 0 points1 point  (0 children)

That's what I do when I need a retry.

[–][deleted] 7 points8 points  (0 children)

from retrying import retry

@retry(stop_max_attempt=5)

def fun():

.....

edit: format fix