Check Internet Speed using Python

mahabub.devs3
Mahabubur Rahman
Published on Sep, 27 2024 1 min read 0 comments
image

Install Package - 

pip install speedtest-cli


Write code as bellow  - 

import speedtest as st

def Speed_Test():
	test = st.Speedtest()
	
	down_speed = test.download()
	down_speed = round (down_speed / 10**6, 2)	
	print("Download Speed in Mbps: ", down_speed)
	
	up_speed = test.upload()
	up_speed = round(up_speed / 10**6, 2)
	print("Upload Speed in Mbps: ", up_speed)
	
	ping = test.results.ping
	print("Ping: ", ping)

 

Test it - 

Speed_Test()

 

Output : 

Download Speed in Mbps: 20.84 
Upload Speed in Mbps: 23.94 
Ping: 14.344

 

 

 

0 Comments