[Twisted-web] Using lineReceived with HTTP requests

Andrea Soong girloncrack at yahoo.com
Sat Jun 11 01:28:38 MDT 2005


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:
---------------------------------------------
[start line received]
       HTTP/1.0 200 OK
[end line received]
[start line received]
       Cache-Control: private
[end line received]
[start line received]
       Content-Type: text/html
[end line received]
[start line received]
       Set-Cookie: PREF=ID=aacd1eed2e435ca5:TM=1118474192:LM=1118474192:S=QyMnwhj46cXbhy_1; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
[end line received]
[start line received]
       Server: GWS/2.1
[end line received]
[start line received]
       Date: Sat, 11 Jun 2005 07:16:32 GMT
[end line received]
[start line received]
       Connection: Close
[end line received]
[start line received]
       
[end line received]
---------------------------------------------
 
Does anyone know if there is some incompatibility in using lineReceived with the format of a webpage (i.e. maybe they are missing the standard EOL delimiters)?  dataReceived works fine and outputs the whole webpage at once.  
 
Also, I am using handleRequestEnd to detect the end of the transmission and call request.finish(),  but it does not seem to be getting called at all - the browser just keeps waiting for more data.  I've put a simple request.write("handleRequestEnd called") call on the first line of the method and it does not get written to the screen.  I can't find any explanation for how to use most of the methods in the HTTPClient class in the API - is there a better way to do this (i.e. one that works!) ?
 
 
Thanks,
Andrea


		
---------------------------------
Discover Yahoo!
 Have fun online with music videos, cool games, IM & more. Check it out!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20050611/177451b5/attachment.htm


More information about the Twisted-web mailing list