Partial HTTP downloads using twisted.web.client.Agent

Carlos Valiente <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <[email protected]>
Hi! I need to download a fragment of a file using HTTP. The file is
stored in several hosts, and I need to handle the case where one or
several hosts are down, or do not have a copy of the file, or the
connection fails for any other reason.

Inspired by the Twisted client tutorial
(http://twistedmatrix.com/documents/current/web/howto/client.html),
I've written a function called ``download()``
(http://gist.github.com/481575) which iterates through a list of URLs.
I find the resulting code a bit too long, however -- in particular the
need for the ``FileWriter`` class.

Have I overlooked some Twisted helper code, or some Twisted coding
idiom, that could simplify the example above? Can you guys think of
any way to improve that code fragment?

Thanks a lot,

C
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.