I'm trying to do speed testing using python getting data from speedtest.net. I have been looking through GitHub and found the speedtest-cli, but it has a lot of features I don't need. I just want to make a simple script that will run 3 times. I found some API but I'm not sure how to modify it to loop three times.
import speedtest
servers = []
# If you want to test against a specific server
# servers = [1234]
x=0
for x in range(0, 2):
s = speedtest.Speedtest()
s.get_servers(servers)
s.get_best_server()
s.download()
s.upload()
s.results.share()
results_dict = s.results.dict()
for x in range(0,3)for x in range(3).range(start, end, step)-startinclusively andendexclusively. check the docsmake a simple script that will run 3 times. At least show us what kind of error you've got if range is not real problemresults_dictvalue which gets reset in each loop. You have to either add the result to a variable outside the for loop scope or print off the results each loop like @Aiven answer below.