[Tutor] Help - server health check reporter

Steven D'Aprano steve at pearwood.info
Fri Oct 1 01:32:14 CEST 2010


On Fri, 1 Oct 2010 09:26:16 am Russell Smith wrote:

> I’m trying to put together a script using urllib2, smtplib and
> stripogram/html2text which will use a healthcheck url, read the
> response after loading it and then email me the results without any
> unwanted html tags. I was able to do that but, when I get a timeout
> on one of the servers the script breaks with an error response. 

Could you copy and paste the exact error message, including the full 
traceback?

Also, what version of Python are you using?

> I’m 
> very new to python and I don’t know how to take that error and have
> it sent as well, instead of breaking the script. Any advice or links
> I can check out that might be helpful? I appreciate it.

try:
    code that times out goes here
except Exception as error:
    do something with error


Obviously this isn't exactly Python code, but I can be more specific 
once you've answered the above two questions.


-- 
Steven D'Aprano


More information about the Tutor mailing list