Skip to main content

📦 Speedkit

Python Versions PyPI License

Python SDK for network speed testing

Measures download, upload, and latency with the official Ookla Speedtest CLI and falls back to LibreSpeed when Speedtest is blocked or unavailable.

Features

  • Zero setup — Ookla Speedtest first, LibreSpeed when it is blocked or fails.
  • Automatic binaries — downloaded and cached for your OS on first run.
  • Nearby servers — the lowest-latency server is picked automatically.
  • Self-recovery — failed attempts are retried, broken servers excluded.
  • Uniform results — same fields and units whichever provider ran; client info from geo-IP.

Installation

pip install speedkit

Usage

from speedkit import Speedkit

kit = Speedkit()
result = kit.run()

print(f"download: {result.download / 1_000_000:.1f} Mbit/s")
print(f"upload:   {result.upload / 1_000_000:.1f} Mbit/s")
print(f"ping:     {result.ping:.1f} ms")

data = result.to_dict()  # plain JSON-serializable dict

Or from the command line:

speedkit                  # auto: Ookla, then LibreSpeed
speedkit -p librespeed    # pin one provider
speedkit -t 180           # time budget per provider in seconds
speedkit -a 1             # disable retries

Speedkit() needs no configuration; everything it accepts:

kit = Speedkit(
    provider="auto",   # "auto" | "ookla" | "librespeed" — a pinned provider never falls back
    timeout=120,       # time budget per provider in seconds, covering all attempts
    attempts=2,        # measurement attempts within the budget; 1 disables retries
    cache_dir=None,    # where CLI binaries are cached; None = user cache directory
)

Result format

SpeedtestResult.to_dict() returns download/upload in bits per second and ping in milliseconds:

{
  "client": {
    "ip": "203.0.113.7",
    "isp": "Example ISP",
    "country": "ZZ",
    "city": "Springfield"
  },
  "server": {
    "url": "",
    "name": "Springfield",
    "country": "Freedonia",
    "sponsor": "Example Sponsor",
    "id": "1234",
    "host": "speedtest.example.net:8080",
    "latency": 0.681
  },
  "provider": "ookla",
  "download": 293111520.0,
  "upload": 292265640.0,
  "ping": 0.681,
  "timestamp": "2026-07-19T15:22:48Z",
  "bytes_sent": 418465064,
  "bytes_received": 426981996
}
  • client — from a geo-IP service, identical whichever provider measured.
  • server — the test server that provider picked; unreported fields stay at "" / 0.0.
  • provider — which measurer produced the result.

Geo-IP lookup

Client details come from the first service that answers: ipinfo.ioipwho.isip-api.com.

  • The lookup takes a fraction of a second.
  • If every service is unreachable, the measurement is still returned — with whatever client info the CLI reported.

This sends your IP address to the geo-IP service that answers.

Binaries

Provider Version Platforms
Ookla Speedtest CLI 1.2.0 Linux x86_64/aarch64, macOS
librespeed-cli 1.0.13 Linux x86_64/aarch64, macOS

Binaries are downloaded on first use and cached per platform:

  • Linux — ~/.cache/speedkit
  • macOS — ~/Library/Caches/speedkit

Set SPEEDKIT_OOKLA_BINARY / SPEEDKIT_LIBRESPEED_BINARY to a path of a preinstalled binary to skip downloading entirely — useful for offline machines and locked-down networks.

To pre-download the binaries at image build time (Docker, CI):

python -c "from speedkit.binaries import ookla_binary, librespeed_binary; ookla_binary(); librespeed_binary()"

Running the Ookla provider passes --accept-license --accept-gdpr, which implies acceptance of the Ookla EULA and privacy terms.

Errors

Every error derives from SpeedkitError and carries an actionable hint:

from speedkit import Speedkit, SpeedkitError

try:
    result = Speedkit().run()
except SpeedkitError as error:
    print(error)  # cause, and a hint on how to fix it

UnsupportedPlatformError — no prebuilt binary for this OS/arch; BinaryDownloadError — the binary could not be fetched; SpeedtestError — the measurement itself failed.

License

This repository is distributed under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speedkit-0.1.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speedkit-0.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file speedkit-0.1.0.tar.gz.

File metadata

  • Download URL: speedkit-0.1.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for speedkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5151de85670c95dec5fff3120c42570f6052aeb58811da09e0292f5f4290f2e8
MD5 301c34cae5f9501caed0e3599b1d9647
BLAKE2b-256 c7f24ec28b1fedf3f363e4dd21a0e543aea48c29fd77152855347842f98d34df

See more details on using hashes here.

File details

Details for the file speedkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: speedkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for speedkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f068de39671e7475205194aeb912c8d508f7f8ef74d20897f29d4c0d552d3a0b
MD5 8e87d176bb48e6f21fb318bc170b3c8b
BLAKE2b-256 d6e815da538e5288c9e46c612cbd36d475edfd8b6f011f4617cbbf2d44592109

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page