From 1a05654732b8045e59eddd361ecd972a204aa103 Mon Sep 17 00:00:00 2001 From: LELIONTRIBAL0 Date: Wed, 12 Nov 2025 12:56:59 -0400 Subject: [PATCH 1/2] Update README.md --- 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 7eaad7b9bb545faf634387053dab9196647687d2 Mon Sep 17 00:00:00 2001 From: Enzo Marx <161323562+enzomarx@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:38:04 -0300 Subject: [PATCH 2/2] Add CSV saving functionality for speed test results Added functionality to save speed test results to a CSV file, including timestamp and relevant metrics. Implemented error handling for file operations. --- InternetSpeedTestApp/speed_test_cli.py | 73 ++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/InternetSpeedTestApp/speed_test_cli.py b/InternetSpeedTestApp/speed_test_cli.py index ef2db7d..e123000 100644 --- a/InternetSpeedTestApp/speed_test_cli.py +++ b/InternetSpeedTestApp/speed_test_cli.py @@ -1,6 +1,9 @@ import speedtest import socket import requests +import csv # <-- Added to handle the CSV file +import os # <-- Added to check if the file already exists +from datetime import datetime # <-- Added to the timestamp def get_local_ip(): try: @@ -40,21 +43,85 @@ def perform_speed_test(): "result_link": result_link } +# --- NEW FEATURE ADDED --- +def save_results_csv(data_row): + """ +Saves a data row in a CSV file. +Creates the header if the file does not exist. + """ + FILENAME = 'speedtest_history.csv' + + # Define the headers (columns) of our CSV + # They correspond to the keys of the 'data_to_save' dictionary in the main() function + HEADERS = ['timestamp', 'download', 'upload', 'ping', 'isp', 'external_ip', 'result_link'] + + # 'os.path.isfile' checks if the file already exists. + # We use this to know if we need to write the header. + file_exists = os.path.isfile(FILENAME) + + try: + # 'a' means 'append'. This adds to the end of the file without deleting the content. + # 'newline=""' is important for the csv module to function correctly in Windows. + with open(FILENAME, 'a', newline='', encoding='utf-8') as f: + + # DictWriter is great because it maps dictionaries to CSV rows. + # Using 'fieldnames=HEADERS' ensures the correct column order. + writer = csv.DictWriter(f, fieldnames=HEADERS) + + # If the file did NOT exist, we write the header. + if not file_exists: + writer.writeheader() + + # Write the data line (our dictionary) + writer.writerow(data_row) + + print(f"āœ… Results saved successfully in {FILENAME}") + + except IOError as e: + print(f"āŒ Error saving CSV file: {e}") + except Exception as e: + print(f"āŒ An unexpected error occurred while saving: {e}") +# --- END OF NEW FUNCTION --- + + 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") + 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']}") +# --- BLOCK ADDED TO SAVE --- + print("\nšŸ’¾ Saving results to history...") + + # 1. Obtain the current timestamp in ISO format (default). + current_timestamp = datetime.now().isoformat() + + # 2. Consolidate all the data we want to save into a dictionary. + # The keys (e.g., 'timestamp') MUST MATCH the HEADERS of the save_results_csv function. + data_to_save = { + 'timestamp': current_timestamp, + 'download': results['download'], # We saved the "raw" (float) value for analysis. + 'upload': results['upload'], # Same + 'ping': results['ping'], # Same + 'isp': isp, + 'external_ip': external_ip, + 'result_link': results['result_link'] + } + + # 3. Call the new function to save. + save_results_csv(data_to_save) + # --- END OF ADDED BLOCK --- + if __name__ == "__main__": main() -