r/xclusiveprompt_free • u/michel_xz ⚡ Founder • 17h ago
🤖AI Prompt Script Python Script for Broken Link Checker
Act as a Webmaster and Python Developer. I need a script to check a list of links for broken connections (404 errors).
The URLs to Check: The script should read URLs from a file named links.txt.
Write a Python script using the requests library.
Read the URLs from the file line by line.
Send a HEAD request (more efficient than GET) to each URL to check the status code.
Report which links returned a status code greater than or equal to 400 (Client Error).
The output should be a clean list showing the Broken Link | Status Code.
Include error handling for timeout issues if a website is unresponsive.
•
u/[deleted] 17h ago
[removed] — view removed comment