[Tutor] urllib2.urlopen(....., timeout=)
d at davea.name
Fri Sep 7 17:32:41 CEST 2012
On 09/07/2012 11:16 AM, Ray Jones wrote:
> According to the docs, urlopen has a timeout capability. But it says
> that the timeout = '<object object>'
> I've tried integers as the timeout value, I've tried floats....it
> doesn't complain about my values, but neither does it timeout. Can
> anyone point me to the solution to getting the urlopen to timeout if the
> target system isn't responding for some reason? What kind of objects is
> it expecting?
I'm curious why the docstring says ... timeout = <object object>
but have no clues for you.
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 connections.
So I'd figure it wants an int, or maybe a float, as you've tried. is it
possible that you're opening something which is neither HTTP, HTTPS nor
FTP? What parameters exactly are you passing to urlopen ?
I hope somebody can help more.
More information about the Tutor