Internet Speed Test wrote in Python3


Peachy Software logo

So I decided to program a simple Internet speed test to check if you are ready to stream 4K content ready for when 4K game streaming starts.

Before you copy and paste the code from below you need to download a python module called pyspeedtest -
https://pypi.org/project/pyspeedtest/

If you don't have pip installed on your machine you can install it from here -
https://www.makeuseof.com/tag/install-pip-for-python/

To install pyspeedtest open up your Terminal and type the following command - pip3 install pyspeedtest

***NOTE***

Upload module from pyspeedtest for some reason no longer works, so I have commented this out of the script, if you modify this and get the upload to work then please let me know!

Your now ready to run the below Python script…

import pyspeedtest
import datetime
from decimal import Decimal

'''Please make sure you intall pyspeedtest via pip before running this script
Copy and Paste this command into your terminal - pip3 install pyspeedtest'''

print("Internet Speed Test v1.0 By Grant Peach 2019 http://bigpesh.co.uk\n")
print("***CHECKING CONNECTION PLEASE WAIT***")
#Enter your test server URL
date = datetime.datetime.today().replace(microsecond=0)
test_server = ("speedtest.serv.pt")
tester = pyspeedtest.SpeedTest(test_server)
download = tester.download()
#upload = tester.upload()
ping = tester.ping()

#Converts the Float to Int
d = int(download)
#u = int(upload)
p = int(ping)

#4k streaming best number mbps
four_k = 3125

#Prints the results
print("\nUsing server -", test_server, "On", date)
print("\nYour Results are...\n")
print("Download Speed is -", d, "Mbps")
#print("Your Up Speed is - ", u, "Mbps")
print("Ping to server is -", p, "ms\n")
if d > four_k:
print("Your connection is also good for streaming 4K content")
else:
print("Your connection is not capable of streaming 4K content")
print("\n***TEST COMPLETE***")