DEV Community

Discussion on: Speedtest.net on Python!

Collapse
 
zenulabidin profile image
Ali Sherief

From my observations in the speedtest-cli code, it appears that each major data center is hosting the server-side part where speedtest-cli uploads to and downloads from as part as those tests. It also collects the upload, download speeds, latency of the connection and also naming information about the data center itself.

But here is the most important part: The upload and download tests are sending chunks of data in an interval. Sequences of repeated0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ strings. The size of each chunk is about 10KB. It's probably to give speedtest a more uniform measurement of how fast that chunk size gets through, as opposed to sending strings of different sizes.

Here is where the chunk data is assembled. Then it's put in a GET or PUT request depending on the test. The function name is a misnomer: It doesn't actually read anything from a file even though it's called for both upload and download tests.