En Sat, 10 Jan 2009 00:07:15 -0200, p. <ppetr...@gmail.com> escribió:

i'm using urllib2 in python 2.4

wondering how people typically deal with the case in which a download
is too slow. setting the socket timeout only covers those cases where
there is no response in the socket for whatever the timeout period is.
what if, however, i'm getting bits back but want simply to bail out if
the total time to download takes too long?

i'm trying to avoid creating a whole other thread if possible?

You may use signal.alarm if it is available on your platform.
On Windows, using a separate thread for reading is the easiest option - unless you plan to download hundreds of files simultaneously.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to