Skip to content

Instantly share code, notes, and snippets.

@hackerdem
Last active March 27, 2026 08:39
Show Gist options
  • Select an option

  • Save hackerdem/2872d7f994d192188970408980267e6e to your computer and use it in GitHub Desktop.

Select an option

Save hackerdem/2872d7f994d192188970408980267e6e to your computer and use it in GitHub Desktop.
A simple python script to check broken links of a wesite
@saiteja13427

Copy link
Copy Markdown

Hey, try to include a header as well with the urlopen request. Some website gives 403 forbidden if the request is unknown. It should look something like
url = "https://atomstalk.com" headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1)'} info = urllib.request.urlopen(urllib.request.Request(url=url, headers=headers))

@Rini-bosco

Copy link
Copy Markdown

how to debug if code is not working for a given url ??

@tiffanyveritas

Copy link
Copy Markdown

Thanks. It works right out of the box!

@Akanksha0704

Copy link
Copy Markdown

can someone explain each parts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment