On Tue, 2012-09-25 at 14:31 +0200, Zdeněk Pavlas wrote: > --- > urlgrabber/grabber.py | 9 ++++++++- > 1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py > index 2ba3603..6956a59 100644 > --- a/urlgrabber/grabber.py > +++ b/urlgrabber/grabber.py > @@ -92,6 +92,11 @@ GENERAL ARGUMENTS (kwargs) > the curl documentation on CURLOPT_CONNECTTIMEOUT for more information. > http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTCONNECTTIMEOUT > > + low_speed_limit = 1 > + > + a minimum bytes/second limit. If the download speed falls below > + this threshold for more than timeout seconds, download is aborted. > + > bandwidth = 0
I hate the name, apart from that I don't mind either patch (although you should also update the documentation for "timeout", to at least point to the new option). Also use BytesOption() and not IntOption(). > the nominal max bandwidth in bytes/second. If throttle is a float > @@ -946,6 +951,7 @@ class URLGrabberOptions: > self.opener = None > self.cache_openers = True > self.timeout = 300 > + self.low_speed_limit = 1 > self.text = None > self.http_headers = None > self.ftp_headers = None > @@ -1364,7 +1370,7 @@ class PyCurlFileObject(object): > if hasattr(opts, 'timeout'): > timeout = int(opts.timeout or 0) > self.curl_obj.setopt(pycurl.CONNECTTIMEOUT, timeout) > - self.curl_obj.setopt(pycurl.LOW_SPEED_LIMIT, 1) > + self.curl_obj.setopt(pycurl.LOW_SPEED_LIMIT, opts.low_speed_limit) > self.curl_obj.setopt(pycurl.LOW_SPEED_TIME, timeout) Given that it pairs with "timeout", random guesses for other names: limitout - maybe too small and kind of ugly? timeout_limit - shows pairing, limit what? timeout_persec - would everyone understand what persec means? timeout_bytes - would everyone understand that it's per second? ...can anyone else think of better names? Also does anyone think we should change the default from 1? _______________________________________________ Yum-devel mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum-devel
