Skip to main content

fastdotcom-ng

CI PyPI version Python versions License: MIT Downloads

A clean-room, modern asyncio + aiohttp Python library and CLI to measure Internet speed (download, upload, unloaded latency, and loaded latency) using Netflix's Fast.com API v2 — designed as a 100% drop-in compatible replacement for fastdotcom in Home Assistant.

Highlights

  • Pure asyncio + aiohttp: Zero requests, urllib.request, threading, or icmplib.
  • Single API v2 Discovery Call: Discovers client metadata and targets in one call, with UTF-8 + latin-1 fallback decoding for non-UTF-8 city names.
  • Rootless HTTP Latency Probes: Uses GET /speedtest/range/0-0 keep-alive requests instead of ICMP raw sockets (works unprivileged inside containers and Home Assistant OS).
  • Dynamic Scaling & Clean Cancellation: Dynamically scales parallel connections (1 -> 3 -> 5 -> max) with sliding-window speed tracking and guaranteed task cleanup.
  • Zero-Bottleneck Upload Streaming: Streams a pre-allocated reusable buffer with explicit Content-Length (required by Netflix OCA endpoints) instead of calling os.urandom() per loop.
  • Home Assistant Drop-In & Native Async Ready:
    • from fastdotcom import fast_com provides synchronous drop-in compatibility.
    • async_fast_com(session=...) and FastDotComClient(session=...) accept an external aiohttp.ClientSession without ever closing caller-owned sessions.
    • Typed exceptions (FastDotComError) replace silent 0 returns.
  • PEP 561 Typed: Ships py.typed with strict mypy verification.

Installation

uv add fastdotcom-ng

Or with pip:

pip install fastdotcom-ng

Usage

import asyncio
import aiohttp
from fastdotcom import async_fast_com


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        result = await async_fast_com(session=session)
        print(
            f"Download: {result.download_speed} Mbps | "
            f"Upload: {result.upload_speed} Mbps | "
            f"Unloaded: {result.unloaded_ping} ms | "
            f"Loaded: {result.loaded_ping} ms"
        )


asyncio.run(main())

Reusable Client

import asyncio
from fastdotcom import FastDotComClient


async def main() -> None:
    async with FastDotComClient() as client:
        result = await client.run_speedtest(max_time=10.0, ping_count=5)
        print(result.to_dict())


asyncio.run(main())

Synchronous Drop-In (Home Assistant Compatible)

from fastdotcom import fast_com

metrics = fast_com()
# {
#     "download_speed": 612.45,
#     "upload_speed": 318.92,
#     "unloaded_ping": 3.41,
#     "loaded_ping": 14.28,
#     "success": 1,
# }

Command-Line Interface

fastdotcom
fastdotcom --json --max-time 10 --ping-count 5
fastdotcom --no-upload --ipv4

Provenance & License

fastdotcom-ng is an independent, clean-room MIT implementation written from scratch by Marco Sousa to replace the unmaintained legacy fastdotcom package (nkgilley/fast.com) while preserving its public fastdotcom import namespace and Home Assistant dictionary contract.

Licensed under the MIT License.

Metadata

Release files for fastdotcom-ng 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastdotcom-ng 1.0.0
File Size Uploaded Provenance Actions
fastdotcom_ng-1.0.0.tar.gz 144.1 kB With provenance Details for fastdotcom_ng-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastdotcom-ng 1.0.0
File Interpreter ABI Platform Actions
fastdotcom_ng-1.0.0-py3-none-any.whl Python 3 none any Details for fastdotcom_ng-1.0.0-py3-none-any.whl

Total release size: 159.8 kB

Release files / fastdotcom_ng-1.0.0.tar.gz

Download URL fastdotcom_ng-1.0.0.tar.gz
Size 144.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c50287b549717374f17d410eb95dd409c2fc9ac5d8660010cb756576db149374
BLAKE2b-256 checksum
How to use checksums
5cb706700478ad5e1267a17928d62efdf7e789025f399c5a94a20861732c7e55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / fastdotcom_ng-1.0.0-py3-none-any.whl

Download URL fastdotcom_ng-1.0.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fe7ec2928dc9c55a1dd48e11a0136a7123f2dea7dc8c2b40c52d1ca10e3f5f0
BLAKE2b-256 checksum
How to use checksums
0b49c842b721719e949f4eba8e6b4aa575c32c75ca0617f494789d8c555d641f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for fastdotcom-ng 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fastdotcom_ng-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

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