An open API service indexing awesome lists of open source software.

https://github.com/notaussie/speedtest.py

A simple OOP wrapper for Ookla's Speedtest CLI.
https://github.com/notaussie/speedtest.py

cli-wrapper python python-3-10 python3 speedtest-cli wrapper

Last synced: 4 months ago
JSON representation

A simple OOP wrapper for Ookla's Speedtest CLI.

Awesome Lists containing this project

README

        

## `🛜` 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](https://www.speedtest.net/) built around the OOP coding style. We also use zero external packages/modules.


## `📥` Installing
> Speedtest.py requires the [Speedtest.net CLI](https://www.speedtest.net/apps/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
```python
# 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
```python
# 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