Metadata-Version: 2.4
Name: dz-speedtest-cli
Version: 2.2.1
Summary: Command line interface for testing internet bandwidth using speedtest.net
Home-page: https://github.com/DownloaderZone/Speedtest-Cli
Author: DownloaderZone
License: Apache-2.0
Project-URL: Homepage, https://github.com/DownloaderZone/Speedtest-Cli
Project-URL: Repository, https://github.com/DownloaderZone/Speedtest-Cli
Project-URL: Issues, https://github.com/DownloaderZone/Speedtest-Cli/issues
Keywords: speedtest,speedtest.net,ookla
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

speedtest-cli
=============

Command line interface for testing internet bandwidth using speedtest.net.

Repository: https://github.com/DownloaderZone/Speedtest-Cli

Official Ookla Speedtest CLI
----------------------------

**Always use official**: For maximum throughput (especially gigabit/multi-gigabit lines), official Ookla latency measurement, and server compatibility, the official Ookla Speedtest CLI binary is recommended.

To remove legacy speedtest-cli and install the official Ookla Speedtest CLI:

::

    sudo apt-get remove speedtest-cli
    sudo apt-get install curl
    curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
    sudo apt-get install speedtest

This Python CLI automatically detects and delegates to the official Ookla binary when installed on your system. You can force official delegation with ``--official`` or force the pure Python implementation with ``--pure-python``.

Supported Python Versions
-------------------------

``speedtest-cli`` requires **Python 3.8+** (tested through Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14+).

Legacy Python 2.x and ancient Python 3 (< 3.8) support has been completely removed to ensure high reliability, modern TLS security, and standard library compliance.

Installation
------------

Pip / PyPI
~~~~~~~~~~

::

    pip install dz-speedtest-cli

or directly from GitHub:

::

    pip install git+https://github.com/DownloaderZone/Speedtest-Cli.git

Github
~~~~~~

::

    git clone https://github.com/DownloaderZone/Speedtest-Cli.git
    cd Speedtest-Cli
    python setup.py install

Direct Download
~~~~~~~~~~~~~~~

::

    curl -Lo speedtest-cli https://raw.githubusercontent.com/DownloaderZone/Speedtest-Cli/master/speedtest.py
    chmod +x speedtest-cli

Usage
-----

::

    $ speedtest-cli -h
    usage: speedtest-cli [-h] [--no-download] [--no-upload] [--single] [--bytes]
                         [-u {bps,kbps,Mbps,Gbps,B/s,kB/s,MB/s,GB/s,auto}]
                         [-f {human-readable,json,json-pretty,csv,tsv}]
                         [-p PROGRESS] [--no-progress] [--share] [--simple] [--csv]
                         [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json]
                         [-L] [-s SERVER] [-o HOST] [--exclude EXCLUDE]
                         [--mini MINI] [-i SOURCE] [-I INTERFACE]
                         [--timeout TIMEOUT] [--secure] [--no-pre-allocate] [-V]
                         [-v] [--selection-details] [--accept-license]
                         [--accept-gdpr] [--official] [--pure-python]

    Command line interface for testing internet bandwidth using speedtest.net.
    --------------------------------------------------------------------------
    https://github.com/DownloaderZone/Speedtest-Cli

    options:
      -h, --help            show this help message and exit
      --no-download         Do not perform download test
      --no-upload           Do not perform upload test
      --single              Only use a single connection instead of multiple. This
                            simulates a typical file transfer.
      --bytes               Display values in bytes instead of bits. Does not
                            affect the image generated by --share, nor output from
                            --json or --csv
      -u, --unit {bps,kbps,Mbps,Gbps,B/s,kB/s,MB/s,GB/s,auto}
                            Output unit for speed (bps, kbps, Mbps, Gbps, B/s,
                            kB/s, MB/s, GB/s, auto)
      -f, --format {human-readable,json,json-pretty,csv,tsv}
                            Output format (human-readable, json, json-pretty, csv,
                            tsv)
      -p, --progress PROGRESS
                            Display progress meter (yes or no)
      --no-progress         Disable progress meter
      --share               Generate and provide a URL to the speedtest.net share
                            results image, not displayed with --csv
      --simple              Suppress verbose output, only show basic information
      --csv                 Suppress verbose output, only show basic information
                            in CSV format. Speeds listed in bit/s and not affected
                            by --bytes
      --csv-delimiter CSV_DELIMITER
                            Single character delimiter to use in CSV output.
                            Default ","
      --csv-header          Print CSV headers
      --json                Suppress verbose output, only show basic information
                            in JSON format. Speeds listed in bit/s and not
                            affected by --bytes
      -L, --list, --servers
                            Display a list of speedtest.net servers sorted by
                            distance
      -s, --server, --server-id SERVER
                            Specify a server ID to test against. Can be supplied
                            multiple times
      -o, --host HOST       Specify a server host (e.g. host:port) to test against
      --exclude EXCLUDE     Exclude a server from selection. Can be supplied
                            multiple times
      --mini MINI           URL of the Speedtest Mini server
      -i, --source, --ip SOURCE
                            Source IP address to bind to
      -I, --interface INTERFACE
                            Source network interface to bind to
      --timeout TIMEOUT     HTTP timeout in seconds. Default 10
      --secure              Use HTTPS instead of HTTP when communicating with
                            speedtest.net operated servers
      --no-pre-allocate     Do not pre allocate upload data. Pre allocation is
                            enabled by default to improve upload performance. To
                            support systems with insufficient memory, use this
                            option to avoid a MemoryError
      -V, --version         Show the version number and exit
      -v, --verbose         Logging verbosity (can specify multiple times: -v,
                            -vv)
      --selection-details   Show details of the server selection
      --accept-license      Acknowledge license (for compatibility with Ookla CLI)
      --accept-gdpr         Acknowledge GDPR notice (for compatibility with Ookla
                            CLI)
      --official            Force delegation to official Ookla speedtest CLI
                            binary
      --pure-python         Force using the pure-Python speedtest engine

Inconsistency
-------------

Server selection
~~~~~~~~~~~~~~~~

The Python engine discovers current nearby servers and selects the **nearest
reachable server** by geographic distance. Servers at the same distance are
compared using the median of three HTTP round-trip measurements. Unreachable
servers are skipped. Discovery falls back to the legacy server catalog if the
current API is unavailable.

To inspect the selection::

    python speedtest.py --pure-python --selection-details

If your ISP's IP geolocation points to the wrong city, supply your actual
latitude and longitude (the coordinates below are an example)::

    python speedtest.py --location 30.9010 75.8573 --selection-details

To compare nearby servers by latency instead of choosing the nearest::

    python speedtest.py --selection latency --selection-details

``--location`` and ``--selection`` automatically use the Python engine. Without
these flags, an installed official Ookla binary still uses its own selection.
Distances depend on client and server coordinates; IP geolocation is an estimate.

Measurement differences
~~~~~~~~~~~~~~~~~~~~~~~

It is not a goal of this application to be a reliable latency reporting tool.

Latency is measured as a full HTTP round trip, including connection setup and
reading the latency response. It is not an ICMP ping measurement.

There is the potential for pure Python HTTP-based tests to report results lower than official socket-based tests on high bandwidth connections (gigabit+). For official line rates, install the official Ookla CLI via the instructions above.
