Как применить timeout в urllib (Python 2.7.3), пробовал так:
urllib.urlopen(decodeURL, timeout = 1)
Не выходит.
urllib.urlopen(decodeURL, timeout = 1)
import urllib2 import socket try: urllib2.urlopen("http://example.com", timeout = 1) except urllib2.URLError, e: print "There was an error: ", e except socket.timeout, e: print "There was an error: ", e