From 7f87c5cb3e3487400a208f2542a8b26779844c29 Mon Sep 17 00:00:00 2001 From: Mohammad Sahil <144834170+mdsahilnoob@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:48:35 +0530 Subject: [PATCH 1/2] Create readme.md --- Advanced/Internet_speed_test/readme.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Advanced/Internet_speed_test/readme.md diff --git a/Advanced/Internet_speed_test/readme.md b/Advanced/Internet_speed_test/readme.md new file mode 100644 index 00000000..ca2513e4 --- /dev/null +++ b/Advanced/Internet_speed_test/readme.md @@ -0,0 +1,2 @@ +Internet Speed Tester +This is a internet speed tester made in python From 107db6506f1c39f03ef2f605cbfde6f2a497a871 Mon Sep 17 00:00:00 2001 From: Mohammad Sahil <144834170+mdsahilnoob@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:50:22 +0530 Subject: [PATCH 2/2] Create code.py --- Advanced/Internet_speed_test/code.py | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Advanced/Internet_speed_test/code.py diff --git a/Advanced/Internet_speed_test/code.py b/Advanced/Internet_speed_test/code.py new file mode 100644 index 00000000..cbd9c77d --- /dev/null +++ b/Advanced/Internet_speed_test/code.py @@ -0,0 +1,46 @@ +import speedtest + + +def speedtester(): + st = speedtest.Speedtest() + + print("Loading server list...\n") + st.get_servers() + print("Choosing best server...") + best = st.get_best_server() + print(f"Found: {best['host']} located in {best['country']}") + + option = int( + input( + """What speed do you want to test: + + 1) Download Speed + + 2) Upload Speed + + 3) Ping + + Your Choice: """ + ) + ) + + if option == 1: + print("Performing download test...") + downloadresult = st.download() + print(f"Download speed: {downloadresult / 1024 / 1024: .2f} Mbit/s") + + elif option == 2: + print("Performing upload test...") + uploadresult = st.upload() + print(f"Upload result : {uploadresult /1024 /1024:.2f} Mbit/s") + + elif option == 3: + ping_result = st.results.ping + print(f"Ping: {ping_result}ms") + + else: + print("Please enter the correct choice !") + + +if __name__ == "__main__": + speedtester()