Don't require people to explicitly perform all steps, retrieve servers if not already retrieved, select closest if not already selected
This commit is contained in:
parent
b846f4dd88
commit
9ef5620b58
|
@ -616,6 +616,9 @@ class Speedtest(object):
|
|||
geographic distance
|
||||
"""
|
||||
|
||||
if not self.servers:
|
||||
self.get_servers()
|
||||
|
||||
for d in sorted(self.servers.keys()):
|
||||
for s in self.servers[d]:
|
||||
self.closest.append(s)
|
||||
|
@ -627,11 +630,16 @@ class Speedtest(object):
|
|||
|
||||
return self.closest
|
||||
|
||||
def get_best_server(self, servers):
|
||||
def get_best_server(self, servers=[]):
|
||||
"""Perform a speedtest.net "ping" to determine which speedtest.net
|
||||
server has the lowest latency
|
||||
"""
|
||||
|
||||
if not servers:
|
||||
if not self.closest:
|
||||
servers = self.get_closest()
|
||||
servers = self.closest
|
||||
|
||||
results = {}
|
||||
for server in servers:
|
||||
cum = []
|
||||
|
|
Loading…
Reference in New Issue