gitmyhub

speedtest-cli

Python ★ 14k updated 1y ago ▣ archived

Command line interface for testing internet bandwidth using speedtest.net

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.

Pythonsetup: easycomplexity 1/5

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.

Where it fits