[Twisted-Python] Using lineReceived with HTTP requests

Jp Calderone exarkun at divmod.com
Sat Jun 11 11:04:53 EDT 2005


On Sat, 11 Jun 2005 00:28:38 -0700 (PDT), Andrea Soong <girloncrack at yahoo.com> wrote:
>Hi all,
>
>First off, I'd like to say thanks to Ken Whitesell for giving me some much needed help.
>
>Here's my problem:  I am using an HTTPClient instance to connect to a webpage, and am trying to retrieve its contents and display to the screen line by line, using the lineReceived method.  This is all being done in an .rpy file.  For some reason, I am only receiving the header information:

The header section of an HTTP response is line-oriented.  The body section is not.  HTTPClient uses both of LineReceivers modes, so for the header section, lineReceived gets called, then for the body section, rawDataReceived gets called.

If you override both of these, you should see all of the data from the server.  Of course, the data passed to rawDataReceive isn't going to be broken up into lines...

Jp




More information about the Twisted-Python mailing list