[Tutor] Re: Tutor digest, Vol 1 #958 - 10 msgs

Blake.Garretson@dana.com Blake.Garretson@dana.com
Mon, 16 Jul 2001 16:59:06 -0400


Kent,
I haven't seen this before, but I bet this would be pretty simple.

I'd use urllib to pull the page back.  Then do a hash() and store the value
in a file somewhere.  Then compare the hash of the current file with the
last time you did it (if the file exists of course.)

For instance, this will get the hash value:

import urllib
myurl=urllib.open("www.google")
pagesource=myurl.read()
hash_value=hash(pagesource)

Then just write a save to disk and comparison routine.  If the page has
changed at all the hash value will be different.  That's my take on it
anyway.  Someone could probably think of a better way.

-Blake Garretson


>From: Kent Tenney <kent@springfed.com>
>To: <tutor@python.org>
>Date: Sun, 15 Jul 2001 10:38:59 -0500
>Subject: [Tutor] Code to check for changed Web page
>
>Howdy,
>
>I would like to be able to check if a web page has changed
>since the last time I checked it.
>
>Does this already exist?
>
>Thanks,
>Kent
>
>
>-- Kent Tenney, kent@springfed.com on 07/15/2001