Home>
I'm trying to measure the downlink and uplink speeds for a fixed server with python, but I get an exception when down_result = stest.download ().
The behavior of speedtest is to ping and go down and up to the server with the least delay
I heard that the speed rule of is always done, and I always want to fix the connection destination
I thought that I set servers = [28910, 20976], but is this description wrong?
I would like to know how to fix the connection destination and execute the speed test on the two connection destinations.
# 28910 fdcservers.net
# 20976 GLBB Japan
import sys
import speedtest
def get_speed_test ():
servers = [28910, 20976]
stest = speedtest.Speedtest ()
# stest.get_servers (servers) # I thought it was unnecessary because the connection destination was fixed
# stest.get_best_server () # I thought it was unnecessary because the connection destination was fixed
def command_line_runner ():
stest = get_speed_test ()
down_result = stest.download () # An exception is thrown.
up_result = stest.upload ()
mbps_down_result = down_result/1024/1024
mbps_up_result = up_result/1024/1024
result = [mbps_down_result, mbps_up_result]
print (result)
command_line_runner ()
-
Answer # 1
Related articles
- about the operation of python's speedtest module (library)
- i have a question about basic python problems
- about processing to exclude the character string group specified from list in python
- python - about write loop to csv
- about python argument and data definition
- python 3x - about downloading anaconda
- python - about the optimum angle of rotation matrix
- python - about downloading youtube videos by youtube-dl
- about batch change of file name using python
- python - what i don't understand about yolo9000 (v2)
- python, about the fire spread step of forest fire simulation
- about the implementation of combinations in python
- please tell me about the role of python tag = "mychr"
- about python def issues
- pythonista - [python] questions about line splitting in dataframe
- python - about hamiltonian neural networks
- python - about "" "of" "" select === = "" "
- python - about kaggle's titanic: fare's histogram doesn't appear
- python - i'm not sure about add_axes in matplotlib
Trends
- python - you may need to restart the kernel to use updated packages error
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to check the type of a shell script variable
- i want to call a child component method from a parent in vuejs
stest.get_servers (servers)
Without
stest.get_servers ()
If set to, the connection destination may not be fixed.
To fix the connection destination
stest.get_servers (servers)
Must be.
(Get_best_server () checks the ping of the server specified by get_servers and selects the earlier one as the connection destination.)
The reason for the exception is that the def get_speed_test () function returns None. (Regardless of whether you specify servers)
Try modifying it to return a SpeedTest object as shown below.