Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions InternetSpeedTestApp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,30 @@
## Features
- CLI and GUI versions of an internet speed test application.
- Uses `speedtest-cli` to measure download, upload speeds and ping.
- Modern CLI UI with [rich](https://github.com/Textualize/rich): colored panels, tables, and progress spinners.
- Displays local and external IP, ISP, and location.
- Shows server info, test time, and allows saving results to a file.
- Friendly error handling and retry option if the test fails.

## How to Use

### Install Requirements
```bash
```powershell
pip install -r requirements.txt
```

### Run CLI Version
```bash
```powershell
python speed_test_cli.py
```

### CLI Features
- See network details (local IP, external IP, ISP, location)
- See speed test results in a formatted table (download, upload, ping, server, ISP, test time)
- Retry the test if it fails
- Optionally save results to `speedtest_results.txt`

### Run GUI Version
```bash
```powershell
python speed_test_gui.py
```
109 changes: 80 additions & 29 deletions InternetSpeedTestApp/speed_test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import speedtest
import socket
import requests
from rich.console import Console
from rich.table import Table
from rich.progress import Progress, SpinnerColumn, TextColumn
from rich.panel import Panel

def get_local_ip():
try:
Expand All @@ -21,39 +25,86 @@ def get_external_ip_and_isp():
except Exception:
return "N/A", "N/A", "N/A", "N/A"

from datetime import datetime
DOWNLOAD_DIVISOR = 1_000_000
UPLOAD_DIVISOR = 1_000_000

def perform_speed_test():
st = speedtest.Speedtest()
print("🔎 Searching for the best speedtest server based on ping...")
best_server = st.get_best_server()
print(f"✅ Best Server Found: {best_server['host']} located in {best_server['name']}, {best_server['country']}\n")
print("⚡ Measuring download speed...")
download_speed_mbps = st.download() / 1_000_000
print("⚡ Measuring upload speed...")
upload_speed_mbps = st.upload() / 1_000_000
ping_ms = st.results.ping
result_link = st.results.share()
return {
"download": download_speed_mbps,
"upload": upload_speed_mbps,
"ping": ping_ms,
"server": best_server,
"result_link": result_link
}
try:
with Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"), transient=True) as progress:
progress.add_task(description="Searching for best server...", total=None)
best_server = st.get_best_server()
with Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"), transient=True) as progress:
progress.add_task(description="Measuring download speed...", total=None)
download_speed_mbps = st.download() / DOWNLOAD_DIVISOR
with Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"), transient=True) as progress:
progress.add_task(description="Measuring upload speed...", total=None)
upload_speed_mbps = st.upload() / UPLOAD_DIVISOR
ping_ms = st.results.ping
result_link = st.results.share()
test_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
return {
"download": download_speed_mbps,
"upload": upload_speed_mbps,
"ping": ping_ms,
"server": best_server,
"result_link": result_link,
"test_time": test_time
}
except Exception as e:
err = str(e)
if '403' in err:
err = 'Speedtest servers are blocking this client (HTTP 403). Try using a VPN or a different network.'
return {"error": err}

def main():
print("🔍 Starting network details retrieval...\n")
local_ip = get_local_ip()
external_ip, isp, city, country = get_external_ip_and_isp()
print(f"📡 Local IP Address : {local_ip}")
print(f"🌐 External IP Address : {external_ip}")
print(f"🏢 ISP : {isp}")
print(f"📍 Location : {city}, {country}\n")
results = perform_speed_test()
print("\n📊 Speed Test Results Summary:")
print(f"⬇️ Download Speed : {results['download']:.2f} Mbps")
print(f"⬆️ Upload Speed : {results['upload']:.2f} Mbps")
print(f"⏱ Ping : {results['ping']:.2f} ms")
print(f"\n🔗 Share your results with this link: {results['result_link']}")
console = Console()
console.print(Panel("[bold cyan]Internet Speed Test CLI[/bold cyan]", expand=False))
while True:
with Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"), transient=True) as progress:
progress.add_task(description="Retrieving network details...", total=None)
local_ip = get_local_ip()
external_ip, isp, city, country = get_external_ip_and_isp()
table = Table(title="Network Details", show_header=True, header_style="bold magenta")
table.add_column("Type", style="dim")
table.add_column("Value")
table.add_row("Local IP", local_ip)
table.add_row("External IP", external_ip)
table.add_row("ISP", isp)
table.add_row("Location", f"{city}, {country}")
console.print(table)
results = perform_speed_test()
if 'error' in results:
console.print(f"[bold red]Speed test failed:[/bold red] {results['error']}")
retry = console.input("[bold yellow]Do you want to retry? (y/n): [/bold yellow]").strip().lower()
if retry == 'y':
continue
else:
return
result_table = Table(title="Speed Test Results", show_header=True, header_style="bold green")
result_table.add_column("Metric", style="dim")
result_table.add_column("Value")
result_table.add_row("Download", f"{results['download']:.2f} Mbps")
result_table.add_row("Upload", f"{results['upload']:.2f} Mbps")
result_table.add_row("Ping", f"{results['ping']:.2f} ms")
result_table.add_row("Server", f"{results['server']['name']}, {results['server']['country']}")
result_table.add_row("ISP", isp)
result_table.add_row("Test Time", results['test_time'])
console.print(result_table)
console.print(f"[bold blue]Share your results:[/bold blue] {results['result_link']}")
# Optional: Export to file
save = console.input("[bold yellow]Save results to file? (y/n): [/bold yellow]").strip().lower()
if save == 'y':
with open('speedtest_results.txt', 'a', encoding='utf-8') as f:
f.write(f"Test Time: {results['test_time']}\n")
f.write(f"Local IP: {local_ip}\nExternal IP: {external_ip}\nISP: {isp}\nLocation: {city}, {country}\n")
f.write(f"Download: {results['download']:.2f} Mbps\nUpload: {results['upload']:.2f} Mbps\nPing: {results['ping']:.2f} ms\n")
f.write(f"Server: {results['server']['name']}, {results['server']['country']}\n")
f.write(f"Share Link: {results['result_link']}\n")
f.write("-"*40 + "\n")
console.print("[green]Results saved to speedtest_results.txt[/green]")
break

if __name__ == "__main__":
main()
Expand Down
122 changes: 81 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,108 @@
# 📶 Internet Speed Test App

A simple and lightweight Internet Speed Test application written in **Python**. This tool allows you to test your internet speed via **Command Line Interface (CLI)** or a user-friendly **Graphical User Interface (GUI)**.
# Internet Speed Test App 🌐⚡

---
![GitHub release](https://img.shields.io/github/release/LELIONTRIBAL0/InternetSpeedTestApp.svg) ![License](https://img.shields.io/badge/license-MIT-blue.svg)

Welcome to the **Internet Speed Test App**! This application provides a quick, simple, and open-source way to check your internet performance. Unlike online browser-based tools, this app gives you direct access to vital metrics such as download and upload speeds, ping (latency), ISP and external IP address, and a link to share your Speedtest.net results.

## 📸 Screenshots
---

### 🖥️ GUI Version
![image](https://github.com/user-attachments/assets/ac39cf42-b6ba-4061-b2e9-c3994d4f3f89)
## 🚀 New CLI Features (2025)

- Modern CLI UI with [rich](https://github.com/Textualize/rich): colored panels, tables, and progress spinners
- Displays local and external IP, ISP, and location before the test
- Shows server info and test time in the results table
- Friendly error handling and retry option if the test fails
- Option to save results to a file (`speedtest_results.txt`) after a successful test
- Code cleanup and improved structure

---

## 🚀 Features
## Table of Contents

- ✅ Download & Upload speed test
- ✅ Ping (latency) measurement
- ✅ Best server selection
- ✅ ISP and IP address detection
- ✅ CLI & GUI modes
- ✅ Shareable result link
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Technologies Used](#technologies-used)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)

---
![Screenshot 2025-05-15 112841](https://github.com/user-attachments/assets/1c1fd4fd-507a-42c5-b413-cd34734e36b3)

## Features

## 📁 Folder Structure
- **Download Speed**: Measure how fast data can be downloaded from the internet.
- **Upload Speed**: Check how quickly data can be sent to the internet.
- **Ping (Latency)**: Determine the response time of your internet connection.
- **ISP Information**: Get details about your Internet Service Provider.
- **External IP Address**: Find out your public IP address.
- **Result Sharing**: Easily share your Speedtest.net results with a link.
- **Modern CLI UI**: Beautiful output with colors, tables, and spinners (see above)
- **Retry and Save**: Retry failed tests and save results to a file

## Installation

InternetSpeedTestApp/
├── speed_test_cli.py # CLI-based speed test script
├── speed_test_gui.py # GUI-based speed test using Tkinter
├── requirements.txt # Required Python libraries
└── README.md # This documentation file
To install the **Internet Speed Test App**, follow these steps:

yaml
Copy
Edit
1. **Download the latest release** from [here](https://github.com/LELIONTRIBAL0/InternetSpeedTestApp/releases). Make sure to choose the appropriate version for your operating system.
2. **Extract the files** if necessary.
3. **Run the application** by executing the main script in your terminal or command prompt.

---

## 📦 Installation
## Usage

Once you have installed the app, you can start testing your internet speed.

### Run CLI Version
```powershell
python InternetSpeedTestApp/speed_test_cli.py
```

#### CLI Features
- See network details (local IP, external IP, ISP, location)
- See speed test results in a formatted table (download, upload, ping, server, ISP, test time)
- Retry the test if it fails
- Optionally save results to `speedtest_results.txt`

### Run GUI Version
```powershell
python InternetSpeedTestApp/speed_test_gui.py
```

For more details, refer to the [Releases](https://github.com/LELIONTRIBAL0/InternetSpeedTestApp/releases) section.

## Technologies Used

The **Internet Speed Test App** is built using the following technologies:

- **Python**: The primary programming language used for development.
- **Requests**: A library for making HTTP requests to gather data.
- **Socket**: Used for network connections and operations.
- **Speedtest-cli**: A command-line interface for testing internet speed.
- **Modular Design**: The app follows a modular design for easy updates and enhancements.

## Contributing

Install Python packages using pip:
We welcome contributions to improve the **Internet Speed Test App**! If you want to contribute, please follow these steps:

1. **Fork the repository**: Click the "Fork" button at the top right of this page.
2. **Create a new branch**: Use a descriptive name for your branch.
3. **Make your changes**: Implement your features or fixes.
4. **Submit a pull request**: Describe your changes and why they are needed.

pip install -r requirements.txt
python speed_test_cli.py
It will output:
## License

Download Speed
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

Upload Speed
## Contact

Ping
For questions or suggestions, feel free to reach out:

IP Address
- **GitHub**: [LELIONTRIBAL0](https://github.com/LELIONTRIBAL0)
- **Email**: [your_email@example.com](mailto:your_email@example.com)

ISP
## Conclusion

Speedtest result URL
![image](https://github.com/user-attachments/assets/ac39cf42-b6ba-4061-b2e9-c3994d4f3f89)
python speed_test_gui.py
```bash
📃 License
This project is licensed under the MIT License. You are free to use, modify, and distribute it.
The **Internet Speed Test App** offers a straightforward way to measure your internet performance. With its easy-to-use interface and essential features, it stands out as a reliable tool for anyone looking to assess their connection speed. Download the latest version from the [Releases](https://github.com/LELIONTRIBAL0/InternetSpeedTestApp/releases) section and start testing today!

Feel free to explore, contribute, and enhance this open-source project!