Skip to content

Commit 5ec20b1

Browse files
committed
SpeedTest
1 parent 1246d88 commit 5ec20b1

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

speedTest/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This python script allows you to dispense with online speedtests.
2+
3+
## Requirements
4+
5+
For this script to run you need to have speedtest-cli and plyer packages installed
6+
7+
Run the command in terminal to install package
8+
9+
```python
10+
pip install speedtest-cli
11+
```
12+
13+
```python
14+
pip install plyer
15+
```
16+
17+
Or install both the packages using requirements file
18+
19+
```python
20+
pip install -r requirements.txt
21+
```
22+
23+
24+
Run the program using command
25+
26+
``` python
27+
python SpeedTest.py
28+
```

speedTest/SpeedTest.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from plyer import notification
2+
import speedtest
3+
4+
st = speedtest.Speedtest(secure=True)
5+
6+
#information about server for the ping test
7+
names = st.get_servers()
8+
9+
download = st.download() / 1048576
10+
upload = st.upload() / 1048576
11+
ping = st.results.ping
12+
country = st.results.server['country']
13+
city_of_country = st.results.server['name']
14+
15+
16+
# printing the data
17+
print(f"Speedtest from a server located in {city_of_country}, {country}")
18+
print(f"Download Speed: {download:.2f} Mbps, \nUpload Speed: {upload:.2f} Mbps,\nPing: {ping} ms")
19+
20+
21+
# displaying the notification
22+
notification.notify(
23+
title=f"Speedtest from a server located in {city_of_country}, {country}",
24+
message=f"Download Speed: {download:.2f} Mbps, \nUpload Speed: {upload:.2f} Mbps,\nPing: {ping} ms",
25+
# displaying time
26+
timeout=5
27+
)

speedTest/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
speedtest-cli==2.1.3
2+
plyer=2.0.0

0 commit comments

Comments
 (0)