Continue the for loop after a certain amount of time

How could you go to the next iteration of the for loop if the given iteration takes more than a certain time? The code should look something like this.

for i in range(0, max_iterations):
       timer function
       call to api

The timer function will serve to force the for loop to continue to the next iteration if api has not finished. It should work in 120 seconds for this iteration. How will the timer function be recorded? Thank you in advance!

+4
source share

Source: https://habr.com/ru/post/1672773/


All Articles