The document said "blocking operations like the connection attempt",
but it did not say it only covers this time break!
Sorry if you dont want to be in "to" ..
El 9/6/2015 10:44 a. m., "mudongliang" <firstname.lastname@example.org>
> I wonder whether this is a bug for python urllib2.
> The following is the code I used:
> target = protocol + "://" + location + directory +
> start = datetime.now()
> urlrequest = urllib2.Request(target)
> urlresponse = urllib2.urlopen(urlrequest,
> urldata = urlresponse.read()
> except (urllib2.URLError, socket.timeout):
> return "ERR"
> stop = datetime.now()
> time_difference = stop - start
> print("\ntime diff is " +
> According to the definition of socket.timeout,
> be no more than 4 seconds or no part of output.
I think timeout is refering to connection timeout.
Ser at doc of urlopen:
"The optional timeout parameter specifies a
timeout in seconds for blocking operations like the connection
attempt (if not specified, the global default timeout setting
will be used). This actually only works for HTTP, HTTPS and FTP