Merge pull request #1 from josuer08/Minor-fixes
[speedtestpy/.git] / spdtest.py
1 import speedtest
2 import pprint
3 pp = pprint.PrettyPrinter(indent=4)
4 #first we need impot speedtest check it how you can do it in your OS
5 servers = []
6 st = speedtest.Speedtest()
7 st.get_servers(servers)
8 bestservers = st.get_best_server()
9 print("The best server found for this test is")
10 pp.pprint(bestservers)
11 def testing(option,option1,option2):
12
13         if option == 1 and option1 == 2 and option2 == 3:
14                 mb=(st.download()*1.0E-6)
15                 print("Download speed:","{0:.2f}".format(mb),"mb")
16
17                 mb2=(st.upload()*1.0E-6)
18                 print("Upload  speed:","{0:.2f}".format(mb2),"mb")
19
20                 servernames =[]
21                 st.get_servers(servernames)
22                 print("Ping:",st.results.ping,'ms')
23
24         else:
25                 print("Please enter the correct choice!")
26
27 print("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-")
28 print("Test in process please wait...")
29 testing(1,2,3)
30 print("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-")