From f711aae3a9a821908a56ab81e100c14202425072 Mon Sep 17 00:00:00 2001 From: Aswin Date: Sat, 13 Nov 2021 20:44:22 +0530 Subject: [PATCH 1/3] Updated speedtest-cli version to account for the changes made in their API --- Scripts/Miscellaneous/Wifi_Speed/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Miscellaneous/Wifi_Speed/requirements.txt b/Scripts/Miscellaneous/Wifi_Speed/requirements.txt index 5577283ae..09cbe4da2 100644 --- a/Scripts/Miscellaneous/Wifi_Speed/requirements.txt +++ b/Scripts/Miscellaneous/Wifi_Speed/requirements.txt @@ -1 +1 @@ -speedtest-cli==2.1.2 +speedtest-cli==2.1.3 From 32c484a9cfb4a3e5e461030dbe48164ed9337f2a Mon Sep 17 00:00:00 2001 From: Aswin Date: Sat, 13 Nov 2021 20:45:48 +0530 Subject: [PATCH 2/3] Added a try and except block to handle the error due to no network connectivity. --- Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py b/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py index 7a836ae11..c4509b118 100644 --- a/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py +++ b/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py @@ -2,9 +2,14 @@ # Python module for testing internet bandwidth import speedtest +from sys import exit # Creating a instance -s = speedtest.Speedtest() +try: + s = speedtest.Speedtest() +except speedtest.ConfigRetrievalError: + print('Sorry, looks like you are not connected to any network!\nPlease make sure you are connected to the internet.') + exit() # Menu print("Select a valid option from below:\n") From 64b0ce91d5a76029a8ea0768bd5692ea23e2007b Mon Sep 17 00:00:00 2001 From: Aswin Date: Sat, 13 Nov 2021 21:07:13 +0530 Subject: [PATCH 3/3] Updated README file with dependency installation command. --- Scripts/Miscellaneous/Wifi_Speed/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Scripts/Miscellaneous/Wifi_Speed/README.md b/Scripts/Miscellaneous/Wifi_Speed/README.md index bd12bbef5..1360d6c36 100644 --- a/Scripts/Miscellaneous/Wifi_Speed/README.md +++ b/Scripts/Miscellaneous/Wifi_Speed/README.md @@ -4,6 +4,9 @@ A simple Python script that uses 'speedtest' module to test the internet bandwid ### Prerequisites You will need to install speedtest module. The installation commands are provided in requirements.txt +```bash + pip install -r requirements.txt +``` ### How to run the script First you have to go to the Wifi_Speed directory. Run the following command once you are in project directory