explaingit

sivel/speedtest-cli

14,069PythonAudience · generalComplexity · 1/5Setup · easy

TLDR

A Python command-line tool that measures your internet download and upload speeds using speedtest.net servers without opening a browser, with JSON and CSV output options for scripting and logging.

Mindmap

mindmap
  root((speedtest-cli))
    What it does
      Measures internet speed
      Uses speedtest.net
      No browser needed
    Output formats
      Plain text
      JSON flag
      CSV flag
      Share URL
    Options
      Skip download test
      Skip upload test
      Single connection mode
      Choose server by ID
    Usage
      CLI one-liner
      Python library
      Cron scheduling
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run an internet speed test from a remote server or headless machine where you cannot open a browser.

USE CASE 2

Log speed test results over time by scheduling the tool with cron and storing CSV output to a file.

USE CASE 3

Compare speeds from different speedtest.net servers by ID to diagnose routing or ISP issues.

USE CASE 4

Call speedtest-cli as a Python library from your own script to embed speed-testing into a monitoring tool.

Tech stack

Python

Getting it running

Difficulty · easy Time to first run · 5min
No license information is mentioned in the explanation.

In plain English

speedtest-cli is a Python command-line tool for measuring your internet connection speed from the terminal. It works by connecting to speedtest.net servers and running download and upload tests, producing the same kind of result you would get from the speedtest.net website but without opening a browser. Running the tool without any arguments automatically picks the nearest speedtest.net server, runs both tests, and prints the results. Several flags let you adjust this behavior: you can skip the download test, skip the upload test, run only a single connection instead of multiple parallel connections (which simulates a typical file transfer more closely), or specify a particular server ID to test against. Output format is also configurable. The default is plain text. Passing --json outputs the results as JSON, and --csv outputs them in CSV format, which makes it straightforward to log results over time or process them in a script. A --share flag generates a results image on speedtest.net and returns a URL you can send to someone. The README includes a note on inconsistency: results from this tool may differ from what speedtest.net shows in a browser because speedtest.net has migrated to socket-based testing while this tool uses HTTP. The latency values the tool reports are also not meant to be precise, they are used internally only to select the best server for the test. Installation is one pip command. The tool can also be used as a Python library if you want to call its functionality from your own code. It supports Python versions from 2.4 through 3.7.

Copy-paste prompts

Prompt 1
Write a bash script that runs speedtest-cli every hour via cron, appends the CSV output to a log file, and sends an alert email if download speed drops below 10 Mbps.
Prompt 2
Use speedtest-cli in a Python script to test internet speed, parse the JSON output, and print a formatted summary showing ping in ms, download Mbps, and upload Mbps.
Prompt 3
I have speedtest-cli installed on a Linux VPS. Show me how to find the server ID for the nearest speedtest.net node in my city and run a test against that specific server.
Prompt 4
Show me how to import speedtest-cli as a Python library in a Flask app and expose a slash speedtest endpoint that returns the current download speed as JSON.
Prompt 5
Write a Python script using speedtest-cli that tests download speed 5 times over 10 minutes and prints the average and standard deviation of the results.
Open on GitHub → Explain another repo

← sivel on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.