Re: 回复: how to download special range content with requests in python?

Chris Angelico rosuav at gmail.com
Thu Jul 24 05:29:51 CEST 2014


On Thu, Jul 24, 2014 at 1:21 PM, 水静流深 <1248283536 at qq.com> wrote:
> i want to write a multiple threads download program to practice my  MT
> knowledge,
> 1)cut the big iso file into 20 parts
> 2)start 20 process with threading and queue module to download
> 3)combine the 20 parts into one iso file.
>
> if i have cut it into 20 parts ,how can i download the first part of it ?
>
> it is target to practice the threading and queue module .  ‍

Well, first off, this won't really benefit much from threading. The
biggest bottleneck is going to be the speed of your connection to that
server. Fetching in parts is likely to actually take longer.

It's certainly possible to do what you want, though. What you want is
to figure out how big the file is, and then ask the server to download
different pieces of it. But you'll need to properly understand what
you're doing on the HTTP level.

I would advise finding some other way to practice threading.

ChrisA



More information about the Python-list mailing list