I wrote a code that does a speed test every 3 hours using python. get_best_server()
can make requests to servers far away from me. When I do it on the website, it really finds the closest city-based. I have the server id closest to me, how can I request it?
import speedtest
test = speedtest.Speedtest(secure=1)
test.get_servers()
best = test.get_best_server()
print(f"Found:{best['host']} located in {best['country']}")
download_result = test.download()
upload_result = test.upload()
ping_result = test.results.ping
print(f"Download Speed: {download_result / 1024 / 1024:.2f} Mbit/s")
print(f"Upload Speed: {upload_result / 1024 / 1024:.2f} Mbit/s")
print(f"Ping: {ping_result}s")