Option to return streaming data from API responses
See original GitHub issueFor potentially large responses which are simply passed directly as a response from my application, I’d like to avoid the overhead of reading in the complete response body, decoding to a string, and parsing the JSON.
I think the best way to expose this would be as an option on Transport.__init__
and extending Connection.perform_request
with a stream
parameter.
For Urllib3HttpConnection.perform_request
this would call urlopen with preload_content=False
and returning the response.stream()
instead of response.data
.
Transport.perform_request
could then simply return the iterator instead calling the deserializer.
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Notes on streaming large API responses
Datasette has the ability to use ASGI trickery to stream all rows from a table (or filtered table) as CSV, potentially returning hundreds...
Read more >Streaming requests with the fetch API - Chrome Developers
This shows how you can stream data from the user to the server, and send data back that can be processed in real...
Read more >Why, when and how to return Stream from your Java API ...
Getting more advanced in Java programming, they find stream() method to convert a collection into a stream and learn how to process data...
Read more >Streaming Data with Spring Boot RESTful Web Service
Spring Boot REST api streaming Options. 1. HttpServletResponse's OutputStream – old approach. This is the oldest approach being used.
Read more >Streams API - MDN Web Docs - Mozilla
Readable streams Represents a readable stream of data. It can be used to handle response streams of the Fetch API, or developer-defined streams ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just to update the
scan
helper (0) now enables ordering so you can use it.Also implementing this is much easier now, just implement a different connection class (whose
perform_request
will just return a lazy object) and a serializer (that will wrap the lazy object in another layer providing deserializarion). Everything else will remain working unchanged.0 - http://elasticsearch-py.readthedocs.io/en/master/helpers.html
This would be incredibly handy especially as ES continues to move more into the analytics space with large data. A little sad to see this was closed.