Given a stream of text, return a stream of json objects. This handles streams which are inconsistently buffered (some entries may be newline delimited, and others are not).
(stream)
| 33 | |
| 34 | |
| 35 | def json_stream(stream): |
| 36 | """Given a stream of text, return a stream of json objects. |
| 37 | This handles streams which are inconsistently buffered (some entries may |
| 38 | be newline delimited, and others are not). |
| 39 | """ |
| 40 | return split_buffer(stream, json_splitter, json_decoder.decode) |
| 41 | |
| 42 | |
| 43 | def line_splitter(buffer, separator='\n'): |