[Twisted-web] Stopping an HTTPDownloader

Jean-Paul Calderone exarkun at divmod.com
Thu Apr 3 18:38:27 EDT 2008

On Thu, 3 Apr 2008 11:39:51 -0400, John Morrissey <jwm at horde.net> wrote:
>I'm writing a small script to record an MP3 stream. It connects to a remote
>host and accepts start/stop commands to control the recording.
>Everything's working, except I can't figure out how to stop the
>HTTPDownloader. When I try to close the HTTP download connection (line 22,
>below), self.stream_factory.protocol (which is an HTTPPageDownloader) has a
>None transport member.

self.stream_factory.protocol _isn't_ an HTTPPageDownloader.  It _is_
HTTPPageDownloader.  Only connected instances have a transport attribute.

You'll need to get a reference to a connected instance and use that, rather
than using the class object.  You may want to do this by overriding the
connectionMade method on an HTTPPageDownloader subclass.


More information about the Twisted-web mailing list