[Zope] i want a timeout interrupt

Horst Wald horstwald@hotmail.com
Wed, 28 Nov 2001 14:48:17 +0000


Hi,

can one interrupt the execution of a script when a certain amount of time 
has passed?

What I want to do:
- I start with a given URL.
- Then I read the webpage denoted by it into a string like
page=urllib.urlopen(URL).read() and if it satisfies a given condition (e.g., 
it contains a certain word), parse it to find out all the urls it contains.
- With these new urls I continue
- I take care not to read the same URL twice

This works fine in general, but there are certain web pages that never 
respond. If you try view them with a browser you get a timeout after a few 
mintues. But the urllib.urlopen() script keeps waiting until it gets a 
response and if never gets one, the whole program is stopped. What I would 
like now is to interrupt the script an return '' if it gets no response 
after 10secs.

Any idea???

Horst

_________________________________________________________________
Downloaden Sie MSN Explorer kostenlos unter http://explorer.msn.de/intl.asp