- About the Project
- Why This Project?
- Features
- Tech Stack
- Project Structure
- Installation
- Usage
- Roadmap
- Contributing
- License
- Author
- Acknowledgments
- FAQ
URL-Checker is a command-line utility that performs two core operations on any given URL:
- Format Validation -- Parses and validates the URL against a comprehensive regex pattern, ensuring it uses a supported scheme (
httporhttps), contains a valid hostname, and follows standard URL syntax. - Connectivity Check -- Sends an HTTP
HEADrequest to the validated URL and reports the server's response status and response time.
The tool is designed for quick, offline URL diagnostics without relying on web interfaces or external services.
When working with URLs in development, scripting, or monitoring workflows, you often need a fast way to answer two questions:
- Is this URL syntactically valid?
- Is the server behind this URL actually reachable?
URL-Checker combines both checks into a single, lightweight CLI invocation. It parses URLs with named regex groups (scheme, host, port, path, query, fragment) and uses httpx for reliable HTTP connectivity testing with redirect following and configurable timeouts.
| Feature | Description |
|---|---|
| URL Format Validation | Regex-based parsing with named capture groups for scheme, host, port, path, query, and fragment |
| HTTP/HTTPS Support | Validates and tests URLs using both http:// and https:// schemes |
| IPv6 Support | Recognizes IPv6 addresses enclosed in brackets (e.g., [::1]) |
| Domain Name Validation | Supports standard domain names with subdomains and TLDs |
| Port Detection | Parses and validates port numbers (1--65535 range) |
| HTTP HEAD Request | Uses lightweight HEAD requests to check reachability without downloading content |
| Redirect Following | Automatically follows HTTP redirects |
| Response Time Measurement | Reports server response time in milliseconds |
| Timeout Handling | Configurable request timeout (default: 10 seconds) |
| Detailed Error Reporting | Clear, descriptive error messages for each failure type |
| Custom User-Agent | Identifies requests with URL-Checker/1.0 User-Agent header |
| Technology | Purpose |
|---|---|
| Python | Primary language |
| httpx | Async-capable HTTP client for connectivity checks |
re (stdlib) |
Regular expression engine for URL parsing |
time (stdlib) |
High-resolution timing via time.monotonic() |
URL-Checker/
├── app.py # Entry point -- orchestrates validation and connectivity check
├── config.py # Constants and compiled URL regex pattern
├── validator.py # URL format validation logic
├── checker.py # HTTP connectivity check via httpx
├── LICENSE # MIT License
└── README.md # This file
- Python 3.10 or higher
pip(Python package manager)
-
Clone the repository
git clone https://github.com/Marsh-Edge/URL-Checker.git cd URL-Checker -
Install the dependency
pip install httpx
-
Verify installation
python app.py
Run the tool from the project directory:
python app.pyYou will be prompted to enter a URL. The tool will validate its format and then test connectivity.
Enter URL to check: https://www.example.com
--------------------------------------------------
[*] Validating URL format... OK
[*] Hostname: www.example.com
[*] Connecting to server... OK
[*] Server responded: 200
[*] Response time: 142 ms
--------------------------------------------------
Result: VALID and REACHABLE (200 - 142ms)
Enter URL to check: not-a-url
--------------------------------------------------
[*] Validating URL format... FAILED
[!] Error: URL must include a scheme (http:// or https://)
--------------------------------------------------
Enter URL to check: https://this-server-does-not-exist.invalid
--------------------------------------------------
[*] Validating URL format... OK
[*] Hostname: this-server-does-not-exist.invalid
[*] Connecting to server... FAILED
[!] Error: Connection failed: ...
--------------------------------------------------
Result: FAILED
- URL format validation via regex
- HTTP/HTTPS scheme support
- IPv6 address recognition
- Domain name and port parsing
- HTTP connectivity check with
httpx - Response time measurement
- Redirect following
- Timeout and error handling
- Machine learning-based URL classification (phishing / malicious detection)
- Batch URL checking from file input
- JSON output mode for scripting and automation
- DNS resolution check
- SSL certificate validation
-
requirements.txtorpyproject.tomlfor dependency management
Contributions are welcome. To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m "Add your feature") - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
Please ensure your code follows the existing style and includes clear commit messages.
This project is licensed under the MIT License. See the LICENSE file for details.
MIT License
Copyright (c) 2025 Marsh
Marsh -- GitHub Profile
- httpx -- A next-generation HTTP client for Python
- Python -- The programming language
- Inspired by the need for a simple, scriptable URL validation and reachability tool
Does this tool support FTP or other protocols?
No. URL-Checker currently only supports http:// and https:// schemes. Other protocols are rejected during validation.
What happens if the server returns a redirect?
The tool follows redirects automatically. The final response status code and time are reported.
Can I use this in a script or automation pipeline?
Not yet. The current version is interactive (reads from stdin). A JSON output mode for non-interactive use is planned in the Roadmap.
Made with Python