Closed mgmarino closed 10 years ago
Fair points! I'll adapt your feedback into the readme and the changes iterator, and cut a new release. Thanks!
See PR #33 , it's fixed there
Wahoo! Thanks again! Closing this so we can use PR #33 as the One True Discussion.
I apologize is this has been covered elsewhere, I didn't see it in any of the older issues.
Currently, if one requests a continuous feed, the returned object is a
requests.Response
object, where the proper way to iterate is:The 'problem' with this is that the
requests.Response.iter_lines
function automatically buffers with chunk_size=512 (hard-coded) meaning that it will stall until this buffer length is reached. Generally a user would expect each line and heartbeat to return as soon as received. The expected behavior can be recovered by passingchunk_size=1
to theiter_lines
function.I think at the very least this should be clearly documented.
Ideally, when the feed is continuous, I would suggest returning the generator with the
chunk_size
correctly set instead of the response object (or perhaps a tuple so that both the generator and the object are available?) so that the user can do:which I think is somewhat cleaner. I'd be happy to put together a pull request, but I thought I'd get some comments first.