12/4/2023 0 Comments Speedtest python script![]() ![]() optional arguments: -d L, -debug L set http connection debug level (default is 0 ) -m M, -mode M test mode: 1 - download 2 - upload 4 - ping 1 + 2 + 4 = 7 - all (default ) -r N, -runs N use N runs (default is 2 ) -s H, -server H use specific server -v, -verbose output additional information -version show program 's version number and exit $ pyspeedtest Using server: Ping: 9 ms Download speed: 148.17 Mbps Upload speed: 18.56 Mbpsįrom a python script: > import pyspeedtest > st = pyspeedtest. Test your bandwidth speed using servers. In a terminal: $ pyspeedtest -h usage: pyspeedtest. Or only for your user $ pip install -user pyspeedtest Usage This package is available from PyPI so you can easily install it with: sudo pip install pyspeedtest Courses for Enterprise Supercharge your engineering team. Educative Enterprise Enablement platform. Please do share your feedback and queries in the comments section below.Python script to test network bandwidth using servers Installation To detect the connected network speed of the computer using Python, we can use the speedtest-cli library. $ speedtest-cli -list | grep -i Nairobiįor more command options, use the –help option. Here, we are listing servers located in Nairobi. If the output contains servers from different regions, use the grep command to filter the output based on your preferred server. To print a list of possible servers based on physical distance, use the –list option. If you just want simplified output that only displays the download and upload speeds, use the –simple option. This contains a PNG image of the speed test results.Ĭopy and paste the URL on a browser and hit ENTER to view the speed test statistics. $ speedtest-cli -shareĪ URL containing the results of the speed test is provided at the very end. You can share the bandwidth results with others using the –share option. It then retrieves a list of possible servers, selects the best server, and proceeds to perform both the download and upload speed tests, and prints out the results on the terminal. $ speedtest-cliĪs you can see, the script begins by retrieving the testing configuration from and identifies your ISP. You can run the speedtest-cli command in its basic form without any arguments as shown. Now, let’s begin testing the speed of our internet connection. Testing the internet connection speed using Speedtest-cli To check the version of the Speedtest-cli tool, run the command: $ speedtest-cli -version $ sudo mv speedtest-cli /usr/bin Check version of Speedtest-cli Then move the speedtest-cli script to the /usr/bin path. $ ls -l | grep speedtestįinally, execute permissions to the speedtest-cli Python script using the chmod command. Once the download is complete, you can verify its presence using the ls command as shown. ![]() To start off, download the script from GitHub using the wget command as shown. The alternative way of installing Speedtest-cli is to download and execute the Speedtest-cli Python script. Install Speedtest-cli using Python script Once the repository is set up, use the APT package manager to install Speedtest-cli as follows. To start off, use the curl command to setup the Speedtest-cli repository. This is the easiest and most straightforward way of installing Speedtest-cli. Install Speedtest-cli using the APT package manager There are various ways of installing the Speedtest-cli tool. Speedtest-cli works with Python 2.4-3.7 For best results, ensure that you have Python 3.6 and later since older versions have been deprecated. Configure scripts to collect speed test results over a period of time.Check the connection from your PC or even a remote server and IoT devices such as Raspberry Pi.Check the bandwidth performance including metrics such as download, upload, and packet loss. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |