A Python wrapper for the Speedtest CLI from Speedtest.net with my own twist.
The goal is to add more features that I can use to track my internet speed over a period of time at certain intervals.
Tool is built with the https://3musketeers.io framework in mind.
- Run a speedtest at intervals using speedtest.net.
- Output results into a CSV file.
- Output results into a Google Doc.
- Output results to a DB (Future)
- Unix-like System or Windows Subsystem Linux.
- Make - If not already installed,
sudo apt update && sudo apt install make
or using your OS own package manager commands. - Docker & Docker Compose - Linux instructions here or install Docker Desktop (Enable WSL Support in setup).
- Google Service Account for Google Sheet/Drive API - Follow instructions here for an Google Service Account.
- First
git clone https://github.com/avolent/net-test.git && cd net-test
- Run
make run_test
within the root of the repository. You will need to run the tool once and authorise your google account before being able to use google sheets. (If you're using Docker Desktop then make sure to have it running in the background and while the command is executing you should see a container called 'net-test' popup) - Once completed, results will be output into the file "./app/output.csv". It will give your google sheet url, every other run will append the results to the same sheet.
- Use crontab to schedule executions automatically.
make run # Run the docker without rebuilding the image.
make build # Build the docker image
make help # Show the help output for speedtest cli.
make servers # List the current preferred servers, based on your location and latency.
make bash # Enter the docker containers bash terminal. (Useful for debugging and developing new features on the fly)
make clean # Remove and delete all docker images, configuration and network adapters
If you want to run custom arguments or specify a server. Do so like this make ARGUMENTS="-f csv -A -s 12345" run_test
- Create a project for the speedtest here
- Enable the following two APIs in your Google Console: Google Drive API & Google Sheets API
- Create a service account here
Service Account Name: Speedtest > Done
- Open that account, go to keys and create a JSON key.
- Download the JSON file, place into your the "/app" directory in the cloned repository. Rename it to
service_account.json
. - Create a spreadsheet with the name "Speedtest" and share access with the client email found in
service_account.json
.
If you would like to develop/test new features for the python script, run make bash
.
This will enter you into the docker container bash environment and allow you to run the script on the fly (python net-test.py
). You can test new changes within the app folder live from using this method.