curl-and-python
Re: Data Stream Question
Date: Fri, 5 Feb 2010 13:39:59 -0800
On Fri, Feb 05, 2010 at 12:58:39PM -0500, Jack Carver wrote:
> I have a persistent http data feed, which keeps appending data to a single
> page, but keeps it open infinitely with a server-side keep-alive signal. If
> trying to use urllib, when I get to feed.read(), it hangs infinitely, and
> just keeps buffering the data, because it's waiting for the connection to
> terminate before it completes the command.
One solution to this problem is to call feed.read() with a length.
Once the requested number of bytes has been read, the function will
return.
> Is it possible at all (using curl) to somehow get chunks of data as
> they come in, and not wait for the connection to terminate?
Yes. I would use the Multi interface, which is asynchronous. That way,
you can let your application decide when to call select() and when to do
work.
-j
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2010-02-05