download x bytes at a time over network

Jean-Paul Calderone exarkun at divmod.com
Mon Mar 16 16:31:28 CET 2009


On Mon, 16 Mar 2009 13:02:07 +0530, Saurabh <phonethics at gmail.com> wrote:
>I want to download content from the net - in chunks of x bytes or characters
>at a time - so that it doesnt pull the entire content in one shot.

This isn't exactly how things work.  The server *sends* you bytes.  It can
send you a lot at once.  To some extent you can control how much it sends
before it waits for you to catch up, but you don't have anywhere near
byte-level control (you might have something like 32kb or 64kb level
control).

If you try downloading a large enough file and increasing the numbers in
your example, then you can probably see the behavior you were expecting.

Jean-Paul



More information about the Python-list mailing list