pyspeedtest cannot find test server
This tutorial is I’m trying to use pyspeedtest to get the upload/download speed of my connecting. but I get the error : Exception: Cannot find a test server. If you change the URL in the pyspeedtest.py file from www.speedtest.net to c.speedtest.net on line 186.
sudo vi /usr/local/lib/python3.6/dist-packages/pyspeedtest.py
# Old code connection = self.connect('www.speedtest.net') # New code connection = self.connect('c.speedtest.net')
Now run pyspeedtest using python in /usr/local/lib/python3.6/dist-packages/pyspeedtest.py.
python3 /usr/local/lib/python3.6/dist-packages/pyspeedtest.py
Output: Using server: speedahm1.jioconnect.com:8080 Ping: 61 ms Download speed: 30.15 Mbps Upload speed: 16.44 Mbps
Use Python Interpreter:
>>> import pyspeedtest
>>> st = pyspeedtest.SpeedTest()
>>> st.ping()
245.42123079299927
>>> st.download()
16356456.45678923
>>> st.upload()
17446457.45687456
You getting this error : Exception: Unable to connect to None
.
SpeedTest Object takes a host parameter. You need to change pyspeedtest package at all.
# Old code st = pyspeedtest.SpeedTest() # New code st = pyspeedtest.SpeedTest(host="c.speedtest.net")