-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Currently the code does not support any kind of retry in order to call the api again to fetch the results. The following piece of code might work for this (this will be wrapped around the base api call so that modifications are needed at only one place)
success = False
for i in range(Constants.max_retries):
if(success):
break
try:
some_result = api_call()
success = True
except Exception as e:
# wait few sec and continue
time.sleep(Constants.sleep_time)
continueWe could keep Constants.max_retries as 3 and Constants.sleep_time as 2.
I am not sure if this is the best way to do this, but if this is something useful, I can add it to the code with a PR. This is useful in cases where the API may not be reachable, or when any part of the package, or an external user is running a loop which calls the api multiple times.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels