From 742142fe5a1df0b924ac705a16fc1c9db2193ec7 Mon Sep 17 00:00:00 2001 From: LELIONTRIBAL0 Date: Sat, 17 May 2025 00:42:49 -0400 Subject: [PATCH 1/5] Commit --- README.md | 97 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index ef56a86..5333033 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,81 @@ -# šŸ“¶ Internet Speed Test App +# 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)**. +![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 +## Table of Contents -### šŸ–„ļø GUI Version -![image](https://github.com/user-attachments/assets/ac39cf42-b6ba-4061-b2e9-c3994d4f3f89) +- [Features](#features) +- [Installation](#installation) +- [Usage](#usage) +- [Technologies Used](#technologies-used) +- [Contributing](#contributing) +- [License](#license) +- [Contact](#contact) +## Features ---- +The **Internet Speed Test App** includes the following features: -## šŸš€ Features +- **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. -- āœ… Download & Upload speed test -- āœ… Ping (latency) measurement -- āœ… Best server selection -- āœ… ISP and IP address detection -- āœ… CLI & GUI modes -- āœ… Shareable result link +## Installation ---- -![Screenshot 2025-05-15 112841](https://github.com/user-attachments/assets/1c1fd4fd-507a-42c5-b413-cd34734e36b3) +To install the **Internet Speed Test App**, follow these steps: +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. -## šŸ“ Folder Structure +## Usage +Once you have installed the app, you can start testing your internet speed. -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 +1. **Open the application**: Launch the app from your terminal or command prompt. +2. **Select the test type**: Choose whether you want to measure download speed, upload speed, or ping. +3. **View your results**: The app will display your internet performance metrics clearly. +4. **Share your results**: Use the provided link to share your Speedtest.net results with friends or colleagues. -yaml -Copy -Edit +For more details, refer to the [Releases](https://github.com/LELIONTRIBAL0/InternetSpeedTestApp/releases) section. ---- +## Technologies Used -## šŸ“¦ Installation +The **Internet Speed Test App** is built using the following technologies: -Install Python packages using pip: +- **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 -pip install -r requirements.txt -python speed_test_cli.py -It will output: +We welcome contributions to improve the **Internet Speed Test App**! If you want to contribute, please follow these steps: -Download Speed +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. -Upload Speed +## License -Ping +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. -IP Address +## Contact -ISP +For questions or suggestions, feel free to reach out: -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. +- **GitHub**: [LELIONTRIBAL0](https://github.com/LELIONTRIBAL0) +- **Email**: [your_email@example.com](mailto:your_email@example.com) +## Conclusion + +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! \ No newline at end of file From 0c0c1c3642d5a71556047288064af0ffe1cb187b Mon Sep 17 00:00:00 2001 From: AtharvaPC Date: Sat, 17 May 2025 11:37:06 +0530 Subject: [PATCH 2/5] Rich UI --- InternetSpeedTestApp/speed_test_cli.py | 56 +++++++++++++++++--------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/InternetSpeedTestApp/speed_test_cli.py b/InternetSpeedTestApp/speed_test_cli.py index ef2db7d..ecd045d 100644 --- a/InternetSpeedTestApp/speed_test_cli.py +++ b/InternetSpeedTestApp/speed_test_cli.py @@ -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: @@ -23,13 +27,17 @@ def get_external_ip_and_isp(): 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 + console = Console() + 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() + console.print(f"[bold green]āœ… Best Server:[/bold green] {best_server['host']} in {best_server['name']}, {best_server['country']}") + 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() / 1_000_000 + 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() / 1_000_000 ping_ms = st.results.ping result_link = st.results.share() return { @@ -41,19 +49,29 @@ def perform_speed_test(): } 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") + console = Console() + console.print(Panel("[bold cyan]Internet Speed Test CLI[/bold cyan]", expand=False)) + 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() - 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']}") + 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") + console.print(result_table) + console.print(f"[bold blue]Share your results:[/bold blue] {results['result_link']}") if __name__ == "__main__": main() From 131da29769bc56f8467edd8377bb3df451a99d4a Mon Sep 17 00:00:00 2001 From: AtharvaPC Date: Sat, 17 May 2025 11:38:36 +0530 Subject: [PATCH 3/5] Exception Handling --- InternetSpeedTestApp/speed_test_cli.py | 45 ++++++++++++++------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/InternetSpeedTestApp/speed_test_cli.py b/InternetSpeedTestApp/speed_test_cli.py index ecd045d..73aa86b 100644 --- a/InternetSpeedTestApp/speed_test_cli.py +++ b/InternetSpeedTestApp/speed_test_cli.py @@ -27,26 +27,27 @@ def get_external_ip_and_isp(): def perform_speed_test(): st = speedtest.Speedtest() - console = Console() - 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() - console.print(f"[bold green]āœ… Best Server:[/bold green] {best_server['host']} in {best_server['name']}, {best_server['country']}") - 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() / 1_000_000 - 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() / 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() / 1_000_000 + 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() / 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 + } + except Exception as e: + return {"error": str(e)} def main(): console = Console() @@ -64,12 +65,16 @@ def main(): 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']}") + 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']}") console.print(result_table) console.print(f"[bold blue]Share your results:[/bold blue] {results['result_link']}") From e64cd8aa50edebdd92bdddf46e5553f802e72385 Mon Sep 17 00:00:00 2001 From: AtharvaPC Date: Sat, 17 May 2025 11:42:30 +0530 Subject: [PATCH 4/5] modern rich UI, error handling, retry, save results, and more --- InternetSpeedTestApp/README.md | 16 ++++- InternetSpeedTestApp/speed_test_cli.py | 86 +++++++++++++++++--------- 2 files changed, 70 insertions(+), 32 deletions(-) diff --git a/InternetSpeedTestApp/README.md b/InternetSpeedTestApp/README.md index fabaafa..3c71826 100644 --- a/InternetSpeedTestApp/README.md +++ b/InternetSpeedTestApp/README.md @@ -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 ``` diff --git a/InternetSpeedTestApp/speed_test_cli.py b/InternetSpeedTestApp/speed_test_cli.py index 73aa86b..4d27ea0 100644 --- a/InternetSpeedTestApp/speed_test_cli.py +++ b/InternetSpeedTestApp/speed_test_cli.py @@ -25,6 +25,10 @@ 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() try: @@ -33,50 +37,74 @@ def perform_speed_test(): 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() / 1_000_000 + 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() / 1_000_000 + 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 + "result_link": result_link, + "test_time": test_time } except Exception as e: - return {"error": str(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(): console = Console() console.print(Panel("[bold cyan]Internet Speed Test CLI[/bold cyan]", expand=False)) - 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']}") - 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']}") - console.print(result_table) - console.print(f"[bold blue]Share your results:[/bold blue] {results['result_link']}") + 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() From 2e7f7eacd5132a9ffe282453aaeb99edeab83dc4 Mon Sep 17 00:00:00 2001 From: AtharvaPC Date: Sat, 17 May 2025 11:47:22 +0530 Subject: [PATCH 5/5] Major upgrade to the CLI version of the Internet Speed Test App --- README.md | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5333033..e2889e0 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,23 @@ + # 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. +--- + +## šŸš€ 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 + +--- + ## Table of Contents - [Features](#features) @@ -14,9 +28,8 @@ Welcome to the **Internet Speed Test App**! This application provides a quick, s - [License](#license) - [Contact](#contact) -## Features -The **Internet Speed Test App** includes the following features: +## Features - **Download Speed**: Measure how fast data can be downloaded from the internet. - **Upload Speed**: Check how quickly data can be sent to the internet. @@ -24,6 +37,8 @@ The **Internet Speed Test App** includes the following features: - **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 @@ -33,14 +48,26 @@ To install the **Internet Speed Test App**, follow these steps: 2. **Extract the files** if necessary. 3. **Run the application** by executing the main script in your terminal or command prompt. + ## Usage -Once you have installed the app, you can start testing your internet speed. +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` -1. **Open the application**: Launch the app from your terminal or command prompt. -2. **Select the test type**: Choose whether you want to measure download speed, upload speed, or ping. -3. **View your results**: The app will display your internet performance metrics clearly. -4. **Share your results**: Use the provided link to share your Speedtest.net results with friends or colleagues. +### Run GUI Version +```powershell +python InternetSpeedTestApp/speed_test_gui.py +``` For more details, refer to the [Releases](https://github.com/LELIONTRIBAL0/InternetSpeedTestApp/releases) section.