

In my case, since I live in Toronto, it found the best server somewhere in downtown of Toronto with the following information: url : lat : 43.6481 lon : -79.4042 name : Toronto, ON country : Canada cc : CA sponsor : Bell Canada id : 17394 host : :8080 d : 18.828394194894738 latency : 8.424 In terms of formatting, it will return a dictionary with the details of that server. In general, this tends to find the best testing server that is within your region (city).

This method allows us to identify the best server that we will be testing the connection from. This method is similar to the previous one, but tests the upload speed of your current connection (in bytes). Print('My download speed is:', s.download()) We should get the following list as the output:Īmazing! Now we found what’s included and now we are going to discuss what operations each of these methods performs.Īs you can probably guess from it’s name, this method will test the download speed of your current connection (in bytes). Using the inspect library (prebuilt in Python), let’s take a look at what methods the s object has:įor method in inspect.getmembers(s, predicate=inspect.ismethod): In other words we want to see what we can use and what information we can retrieve. The next step we are going to take is find out what is actually included in the above class.
INTERNET SPEED TEST CODE
The source code for this library doesn’t currently have a lot of detailed information about each method and their usage so we will explore these from scratch.
INTERNET SPEED TEST INSTALL
If you don’t have them installed, please open “Command Prompt” (on Windows) and install them using the following code:įirst we will need to create an instance of Speedtest() class and then inspect the methods it has and discuss each of them. In order to continue with examples in this article, you will need to install an additional library speedtest-cli. How about trying to test internet speed using Python from your computer in less than 10 lines of code? Let’s take a look! So what do we do when we want to test the speed of our connection? Correct, we go on Google and lookup some speed testing websites and proceed there.

The internet connections in our homes and offices differ by internet service providers (ISPs), allowable traffic limit, and most importantly speed.
