speedtest-cli
speedtest-cli copied to clipboard
Add an option to load the server list from the local file.
In some cases, you need to do tests against the same server each time, but if this server is not available in the get_servers list, then speedtest does not know where the server is.
Example:
-
I want always use the server with id 4243
<server url="https://speedtest.vc.shawcable.net:8080/speedtest/upload.php" lat="49.2505" lon="-123.1119" name="Vancouver, BC" country="Canada" cc="CA" sponsor="Shaw Communications" id="4243" host="speedtest.vc.shawcable.net:8080"/>
-
but it's not available in the list anymore:
Retrieving speedtest.net configuration...
51693) Ziply Fiber (Bothell, WA, United States) [164.12 km]
29820) Bluespan (Easton, WA, United States) [245.09 km]
15300) iFIBER Communications (Ephrata, WA, United States) [310.60 km]
57671) Advanced Internet (Yakima, WA, United States) [331.10 km]
38364) Vyve Broadband (Moses Lake, WA, United States) [339.71 km]
10166) CenturyLink (Spokane, WA, United States) [420.54 km]
27449) Cutting Edge Communications, Inc (Spokane, WA, United States) [420.54 km]
36007) Gonzaga University (Spokane, WA, United States) [420.54 km]
21227) xyTel Inc (Kennewick, WA, United States) [425.06 km]
3126) Pendleton Fiber (Pendleton, OR, United States) [488.51 km]
- it's the server is not in the returned list of servers, speedtest can't use it:
$ ./speedtest.py --server 4243
Retrieving speedtest.net configuration...
Testing from Shaw Communications (###.###.###.###)...
Retrieving speedtest.net server list...
ERROR: No matched servers: 4243
- with
--load-servers
option, I can load server settings from the file:
$ ./speedtest.py --load-servers server-list.txt --server 4243
Retrieving speedtest.net configuration...
Loading file with servers...
Testing from Shaw Communications (###.###.###.###)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by Shaw Communications (Vancouver, BC) [35.99 km]: 55.018 ms
Testing download speed................................................................................
Download: 105.36 Mbit/s
Testing upload speed................................................................................................
Upload: 93.00 Mbit/s
Note:
- currently get_servers still executing and servers from the file are added to the list
- may be
--save-servers
will be a good option
The only way I have found to get a specific server to work, is for example to add something like this to speedtest.py
right above the if (servers or exclude) and not self.servers:
line:
self.servers[7.68] = [{
"url": 'http://speed.hysing.is:8080/speedtest/upload.php',
"lat": '64.1333',
"lon": '-21.9333',
"name": 'Reykjavik',
"country": "Iceland",
"cc": "IS",
"sponsor": "Advania Ísland",
"id": "42305",
"host": "speed.hysing.is.prod.hosts.ooklaserver.net:8080",
'preferred': 1,
'https_functional': 1,
"d": 7.68
}]
That way the specified server gets included in the ping tests and since it is almost 800 km closer than the next one, it obviously wins.
This tool is almost useless without doing this.
The only way I have found to get a specific server to work, is for example to add something like this to
speedtest.py
right above theif (servers or exclude) and not self.servers:
line:self.servers[7.68] = [{ "url": 'http://speed.hysing.is:8080/speedtest/upload.php', "lat": '64.1333', "lon": '-21.9333', "name": 'Reykjavik', "country": "Iceland", "cc": "IS", "sponsor": "Advania Ísland", "id": "42305", "host": "speed.hysing.is.prod.hosts.ooklaserver.net:8080", 'preferred': 1, 'https_functional': 1, "d": 7.68 }]
That way the specified server gets included in the ping tests and since it is almost 800 km closer than the next one, it obviously wins.
This tool is almost useless without doing this.
Thank you for your suggestion. I commented out other parts of this function, and then it worked.
Recently I found speedtest very weird. Week ago it worked. In the morning it retured servers in Vienna (110km) and Bratislava (120km). Now it returns servers in Serbia, Croatia with range from 460 to 620km. Considering my location is Brno, Czechia, distances are correct. Curiously web version from ookla works. Maybe they changed something in their API? Now it's
Cannot retrieve speedtest configuration
ERROR: HTTP Error 403: Forbidden