Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to load the server list from the local file. #799

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

artickl
Copy link

@artickl artickl commented Jul 2, 2023

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:

  1. currently get_servers still executing and servers from the file are added to the list
  2. may be --save-servers will be a good option

@artickl artickl marked this pull request as ready for review July 2, 2023 02:49
@artickl artickl changed the title Add an option to load server list from the local file. Example of the… Add an option to load the server list from the local file. Jul 2, 2023
@Gunni
Copy link

Gunni commented Jul 11, 2023

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.

@duzhuoshanwai
Copy link

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.

Thank you for your suggestion. I commented out other parts of this function, and then it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants