[Twisted-web] Stopping an HTTPDownloader
John Morrissey
jwm at horde.net
Thu Apr 3 19:54:06 EDT 2008
On Thu, Apr 03, 2008 at 05:38:27PM -0500, Jean-Paul Calderone wrote:
> 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.
ach, I had completely missed that. Overriding connectionMade works well.
Thanks, Jean-Paul.
john
--
John Morrissey _o /\ ---- __o
jwm at horde.net _-< \_ / \ ---- < \,
www.horde.net/ __(_)/_(_)________/ \_______(_) /_(_)__
More information about the Twisted-web
mailing list