[Tutor] urllib.urlretrieve ?
Joel Goldstick
joel.goldstick at gmail.com
Sun Apr 7 18:23:37 CEST 2013
On Sun, Apr 7, 2013 at 11:32 AM, Matthew Ngaha <chigga101 at gmail.com> wrote:
> 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
>
You might want to look at requests module:
http://docs.python-requests.org/en/latest/
Many people think it is easier to use than the native python support.
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130407/bd74fcec/attachment.html>
More information about the Tutor
mailing list