Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
/ speedtest.py Public archive

A simple OOP wrapper for Ookla's Speedtest CLI.

License

Notifications You must be signed in to change notification settings

NotAussie/speedtest.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🛜 Speedtest.py

This project is not an offical Speedtest wrapper and therefore is not endorsed by Ookla.

Speedtest.py is a simple asynchronous wrapper for Speedtest.net built around the OOP coding style. We also use zero external packages/modules.


📥 Installing

Speedtest.py requires the Speedtest.net CLI to function.


PIP: pip install speedtest.py

We're in the works of publishing to PIP.


Conda: conda install speedtest.py

We're currently not published on Conda

Example

Examples of using Speedtest.py

1: Basic speedtest

# Imports
from speedtest import Client
import asyncio

# Define the client
client = Client(
  executable="speedtest"  # Only needs changing on Windows or Linux installs that have a different executable/command name.
)

# Define app function
async def app():
  # Run a test with an automatically picked server
  result = await client.test()

  # Print statistics
  print(f"Download bandwidth:  {str(result.download.bandwidth) * 8 / 1_000_000:.2f} Mbps")
  print(f"Upload bandwidth:  {str(result.upload.bandwidth) * 8 / 1_000_000:.2f} Mbps")


asyncio.run(app())

2: Speedtest with selected server

# Imports
from speedtest import Client
import asyncio

# Define the client
client = Client(
  executable="speedtest"  # Only needs changing on Windows or Linux installs that have a different executable/command name.
)

# Define app function
async def app():
  # Get a list of nearby servers
  servers = await client.servers()

  # Run a test with the first server
  result = await client.test(server=servers[0])

  # Print statistics
  print(f"Download bandwidth:  {str(result.download.bandwidth) * 8 / 1_000_000:.2f} Mbps")
  print(f"Upload bandwidth:  {str(result.upload.bandwidth) * 8 / 1_000_000:.2f} Mbps")


asyncio.run(app())

📈 Star History

Star History Chart

Releases

No releases published

Packages

No packages published

Languages