Merge pull request #74 from Abbhiishek/Internet-speed-checker

Internet speed checker
This commit is contained in:
Advaita Saha 2022-10-02 23:28:11 +05:30 committed by GitHub
commit 074bb6248d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,30 @@
# Internet Speed Checker
This script will check your internet speed and with Download and Upload speed , it will also check the ping of your internet connection with your Internet Service Provider.
## ```How to use```
1. Install the Speedtest Package using the following command:
`pip install speedtest`
Official Documentation: https://pypi.org/project/speedtest/
2. Run the script
## ```Output```
The output will be like this:
```
Internet Speed Checker
21:22:38
Connecting to server...
Download: 1.74 Mbit/s
Upload: 22.80 Mbit/s
Ping: 101.68 ms
ISP: Alliance Broadband Services Pvt.
```
## Author
Name: [Abhishek Kushwaha](https://github.com/Abbhiishek)

View File

@ -0,0 +1,37 @@
# Internet Speed Checker
import speedtest
import time
import os
def main():
# Clear the screen
os.system('cls' if os.name == 'nt' else 'clear')
# Print the title
print('Internet Speed Checker')
# Print the current time
print(time.strftime('%H:%M:%S'))
print("Connecting to server...")
# Get the speed
s = speedtest.Speedtest()
s.get_best_server()
s.download()
s.upload()
results_dict = s.results.dict()
# Print the results
print(f"Download: {results_dict['download'] / 1024 / 1024:.2f} Mbit/s")
print(f"Upload: {results_dict['upload'] / 1024 / 1024:.2f} Mbit/s")
print(f"Ping: {results_dict['ping']:.2f} ms")
print(f"ISP: {results_dict['client']['isp']}")
# Wait 5 seconds
time.sleep(5)
if __name__ == "__main__":
main()