From c34cbb6b7322470bcb3286c9bc5cc4ac93f85174 Mon Sep 17 00:00:00 2001 From: Dhruv Bansal Date: Sun, 27 Jun 2021 16:32:18 +0530 Subject: [PATCH] Created a Speed checking script in python 3 named TestMyInternetSpeed (#214) * speedtest using python * main python script for checking speeds * Add files via upload * Delete TestMySpeed.py * Delete requirements.txt * Delete README.md * Update README.md * Update README.md * Revert "Delete README.md" This reverts commit 8d14c3b3e66a0f79e4fb507cd14b7228c6ff3202. reverted the accidentally commited readme file commit * added the readme file i deleted accidentally * Update README.md Co-authored-by: Dhruv Bansal --- README.md | 4 +-- TestMyInternetSpeed/README.md | 20 +++++++++++++ TestMyInternetSpeed/TestMySpeed.py | 43 ++++++++++++++++++++++++++++ TestMyInternetSpeed/requirements.txt | 1 + 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 TestMyInternetSpeed/README.md create mode 100644 TestMyInternetSpeed/TestMySpeed.py create mode 100644 TestMyInternetSpeed/requirements.txt diff --git a/README.md b/README.md index eaf44f5..ecc14a0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Awesome Python Scripts :sunglasses: PyPI [![HitCount](http://hits.dwyl.io/hastagAB/Awesome-Python-Scripts.svg)](http://hits.dwyl.io/hastagAB/Awesome-Python-Scripts) ![GitHub stars](https://img.shields.io/github/stars/hastagAB/Awesome-Python-Scripts?style=social) +# Awesome Python Scripts :sunglasses: PyPI [![HitCount](http://hits.dwyl.io/hastagAB/Awesome-Python-Scripts.svg)](http://hits.dwyl.io/hastagAB/Awesome-Python-Scripts) ![GitHub stars](https://img.shields.io/github/stars/hastagAB/Awesome-Python-Scripts?style=social) ## What is this repo? This repo is a compilation of some *awesome* Python scripts that automate some boring tasks or simply make our life easier...or both! @@ -174,7 +174,7 @@ So far, the following projects have been integrated to this repo: |[Rock-Paper-Scissor Game](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Rock-Paper-Scissor)|[Punit Sakre](https://github.com/punitsakre23)| |[Folder Locker and hider](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Folder%20Locker%20%26%20Hider)|[Prajjwal Pathak](https://github.com/pyguru123)| |[Image Compressor](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Image_Compressor)|[Prathima Kadari](https://github.com/prathimacode-hub)| - +|[Test Your Internet Speed](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/TestMyInternetSpeed)|[TheSmartDeveloperr](https://github.com/thesmartdeveloperr)| ## How to use : diff --git a/TestMyInternetSpeed/README.md b/TestMyInternetSpeed/README.md new file mode 100644 index 0000000..007c9e6 --- /dev/null +++ b/TestMyInternetSpeed/README.md @@ -0,0 +1,20 @@ +## Test Your Internet Speed using Python +speedtest image + +This is a simple but powerful and efficient python program. +You can test your internet bandwidth speed with this script i wrote using just a single command, you will also get a bunch of good options to choose from and the test will be performed with the help of speedtest-cli module in python. + +- Test Download Speed +- Test Upload Speed +- Test Server Pings +- Results in Mbps(Mega bits per second) + +#### How to use + +- Clone the repo or download the zip +- Navigate to the folder of the program in terminal/cmd. +- Install the dependencies using pip install -r requirements.txt +- Run the command python TestMySpeed.py + +(Note: You will need to have python 3 installed and if you are on a unix based OS (macOS, or linux) you may need to run the command using python3 TestMySpeed.py) diff --git a/TestMyInternetSpeed/TestMySpeed.py b/TestMyInternetSpeed/TestMySpeed.py new file mode 100644 index 0000000..0ce8c13 --- /dev/null +++ b/TestMyInternetSpeed/TestMySpeed.py @@ -0,0 +1,43 @@ + +# the package used is speedtest-cli(it is the only package we need) +import speedtest +from time import sleep +speed=speedtest.Speedtest() + +option=int(input(''' +What do you want to know: +1) Download speed +2) Upload speed +3) Both Download and Upload +4) Ping +Your choice: ''')) + +if option<1 or option>4: + sleep(2) + print('You have entered wrong choice, please enter again with values from 1 to 4') +else: + sleep(1) + print() + print('Pls wait, test in progress...') + print() + down_speed=round(speed.download()/1000000,3) + up_speed=round(speed.upload()/1000000,3) + print('One more sec please...') + sleep(2.5) + print() + if option == 1: + print('Your Download speed is: ',down_speed,'Mbps') + elif option == 2: + print('Your Upload speed is: ',up_speed,'Mbps') + elif option == 3: + print('Your Download speed is: ',down_speed,'Mbps',end=" ") + print(',and your Upload speed is: ',up_speed,'Mbps') + + elif option == 4: + s=[] + speed.get_servers(s) + print(speed.results.ping,'ms') + else: + print('Sorry, something went wrong, pls try again...') + + diff --git a/TestMyInternetSpeed/requirements.txt b/TestMyInternetSpeed/requirements.txt new file mode 100644 index 0000000..5977a22 --- /dev/null +++ b/TestMyInternetSpeed/requirements.txt @@ -0,0 +1 @@ +speedtest-cli \ No newline at end of file