[Tutor] urllib.urlretrieve ?

Matthew Ngaha chigga101 at gmail.com
Sun Apr 7 17:32:04 CEST 2013


the whole program depends on the urlretrieve 3rd argument, the
function to be called.. is there no options to include a callback?

def _download(self):

        def reporthook(pos, block, total):
            if self.size != total:
                self._size = total
                self.on_size.emit()
            self.progress = float(pos*block)/float(total)

        urllib.urlretrieve(self._url, self._filename, reporthook)
##3rd arg calls inner function
        self.running = False


More information about the Tutor mailing list