mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-03-13 17:19:50 +00:00
Merge pull request #74 from Abbhiishek/Internet-speed-checker
Internet speed checker
This commit is contained in:
commit
074bb6248d
30
scripts/Internet Speed Checker/Readme.md
Normal file
30
scripts/Internet Speed Checker/Readme.md
Normal 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)
|
37
scripts/Internet Speed Checker/main.py
Normal file
37
scripts/Internet Speed Checker/main.py
Normal 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()
|
Loading…
x
Reference in New Issue
Block a user