1
I did a script on python 3 that performs speed tests on my internet every 60 seconds and writes these results in a file .txt.
Within this script I have a function called get_results which is the function responsible for performing the test of internet speed and return a Dict with the results obtained.
But if during the speed test my connection comes to fall the speed test does not end and my program keeps crashing, forcing me to manually stop it.
What I would like to do is set a time limit for the return of this function get_results and if at the stipulated time she did not return anything to me she would be interrupted and the script would continue with the normal flow of waiting another 60 seconds to perform the new test.
https://stackoverflow.com/questions/492519/timeout-on-a-function-call
– Leonardo Pessoa
Put the code, at least those of the function.
– user62320
I edited the question with the source code.
– Cleyson Lima