timeout in urllib.open()

Peter Otten __peter__ at web.de
Mon Feb 19 05:25:28 EST 2007


Stefan Palme wrote:

> is there a way to modify the time a call of
> 
>   urllib.open(...)
> 
> waits for an answer from the other side? Have a tool
> which automatically checks a list of websites for
> certain content. The tool "hangs" when one of the
> contacted websites behaves badly and "never" answers...

I believe this can only be set globally:

import socket
socket.setdefaulttimeout(seconds)

Peter



More information about the Python-list mailing list