Check URL --> Simply?
Tom Bryan
tbryan at python.net
Tue Aug 14 20:51:28 EDT 2001
JS wrote:
> Is there anything that works like this?
>
> checkLink(url):
> # If url exists, return 1
> # If url does not exist, return 0
>
> All I want to do is check the external links in a html file and log if
> they exist or not. Unfortunately, I am not skilled enough to write
> something myself.
You may also find it interesting to look in the Tools directory of your
Python (source) installation.
$ cat /usr/local/Python-2.1.1/Tools/webchecker/README
Webchecker
----------
This is a simple web tree checker, useful to find bad links in a web
tree. It currently checks links pointing within the same subweb for
validity. The main program is "webchecker.py". See its doc string
(or invoke it with the option "-?") for more defails.
History:
- Jan 1997. First release. The module robotparser.py was written by
Skip Montanaro; the rest is original work by Guido van Rossum.
- May 1999. Sam Bayer contributed a new version, wcnew.py, which
supports checking internal links (#spam fragments in URLs) and some
other options.
- Nov 1999. Sam Bayer contributed patches to reintegrate wcnew.py
into webchecker.py, and corresponding mods to wcgui.py and
websucker.py.
More information about the Python-list
mailing list