Azure / Azure/azure-storage-python
Feature request: expose the underlying request for streaming purposes
- Ngôn ngữ chính
- Python
- Star
- 343
- Fork
- 243
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### Which service(blob, file, queue) does this issue concern?
Blob
### Which version of the SDK was used? Please provide the output of `pip freeze`.
```
azure-storage==0.36.0
```
### What problem was encountered?
Situation: I am running a flask web server as a proxy which returns the corresponding blob that is on Azure Blob Storage. I want to stream the bytes to the client instead of downloading all the bytes to the memory and return the bytes to client at once for performance reasons. As far as I can tell, since the calls in this library are synchronous, there is no way to pipe the bytes from azure to my web clients. Actually the underlying requests library supports streaming. If the request can be exposed, the streaming can be as simple as this (copied from a [StackOverflow thread](https://stackoverflow.com/questions/39272072/flask-send-stream-as-response)):
```
import requests
from flask import Flask, Response, stream_with_context
app = Flask(__name__)
my_path_to_server01 = 'http://localhost:5000/'
@app.route("/")
def streamed_proxy():
r = requests.get(my_path_to_server01, stream=True)
return Response(r.iter_content(chunk_size=10*1024),
content_type=r.headers['Content-Type'])
if __name__ == "__main__":
app.run(port=1234)
```
Also, the `get_blob_to_stream` function is all synchronous, which is not helpful at all.
I am happy if there is any other way to workaround this. Otherwise, exposing the underlying request from requests library is the most direct and preferred way. Thanks!
### Have you found a mitigation/solution?
No.
Hướng dẫn đóng góp
Hướng nghiên cứu
The relevant entry point is get_blob_to_stream; start by reading how it obtains blob content and where the underlying requests call is handled. Compare that path with requests streaming and the Flask proxy example in the issue. Done means the SDK offers a way to stream blob bytes without buffering the full response while preserving its existing synchronous behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, flask, python
- Lĩnh vực
- backend, cloud
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100