[Tutor] Visiting a URL

John Abbe johnca@ourpla.net
Sat Nov 2 12:09:01 2002


At 12:29 AM -0800 on 2002-11-01, Danny Yoo typed:
>On Thu, 31 Oct 2002, John Abbe wrote:
>  > I've got a newbie question -- i'm looking at altering PikiePikie to
>>  notify weblogs.com when my weblog updates. I could get all involved in
>>  XML-RPC, but it's doable through a plain URL. How do i visit a URL in
>>  Python?
>
>Hi John,
>
>Do you mean retrieving the contents of the URL resource?  If so, there's a
>nice module called 'urllib' that allows us to open URLs as if they were
>files.
>
>     http://python.org/doc/lib/module-urllib.html

Very cool. Thanks! Even that may be a little overkill. All i need to 
do is visit the URL; i don't need the response.

On second thought, maybe not a bad idea to get the results and check 
for errors, but still curious.

>There's also a nice set of modules to take the "signature" of a string in
>an efficient way, so that, rather than having to save an exact snapshot of
>a page, you can just store a shorter signature, and do signature
>comparison to see if changes have occurred.  Here's a link to one of these
>signature digest modules:
>
>     http://python.org/doc/lib/module-hmac.html
>
>Hmmm... on second thought, using that hmac module might be overkill, but
>it's still useful to know that it exists.  *grin*

Thanks again -- although wouldn't using ETags or Last-Modified 
headers be more efficient? (i guess it counts on the server to do the 
right thing)

Life,
John
-- 
  All you  /\/\ John Abbe             "If you don't like the news,
      need \  / CatHerder              go out and make some of your own."
      is... \/  http://www.ourpla.net/john/               --Wes Nisker