python FancyURLopener timeout
Question: is there a way to set connection timeout for FancyURLopener()? I'm using
FancyURLopener.retrieve() to download a file, but sometimes it just stucks and
that's all... I think this is because it's still trying to connect and it's
not possible. So is there a way to set that timeout?

Thanks for every reply


Answer: If you want to use `retrieve()` with a timeout, you can set it in the `socket`
module.

    
    
    import socket
    socket.setdefaulttimeout(5)
    

Source: <http://docs.python.org/py3k/howto/urllib2.html#sockets-and-layers>

