New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stream large file to AsyncApp (application/octet-stream) #1877
Comments
Hi @alfechner, I think you have two options:
Agree that this could be more clear in the docs. |
Hi @RobbeSneyders, really appreciate your helpful input here. The I made the stream option work: async def test_stream():
request = Request(scope, receive)
async for chunk in request.stream():
.... Just a note: When passing the body parameter to |
Ok, thanks for diving into this and reporting back. Any reason you're creating a new request instead of importing the one we make available via |
No, you're right. It works the exact same way with |
Is the |
Looks like it, yes 👍 |
I wanted to have another look at the requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
metadata:
type: object
additionalProperties: true
encoding:
metadata:
contentType: application/json I wanted to see if I can modify starlette's I tried to run the original from connexion.context import request
from starlette.formparsers import MultiPartParser
async def test_form_data():
form_data = MultiPartParser(headers=request.headers, stream=request.stream()).parse() I'm running into an Opposed to the In order to disable the validation I unset the body validator for Even tough there is no validation anymore I'm hanging in the Would it make sense to add a |
Description
I would like to stream a large file to my
AsyncApp
. My app is supposed to proxy the incoming bytes to another service. The goal is to reduce the memory footprint.My spec looks like this:
I receive the bytes of my file in
my_controller_function
but already fully loaded. Means, the entire file is in memory already.Is there any way to get hand on the stream in the controller before fully transferring the entire content?
Python 3.12.1
Version: 3.0.5
The text was updated successfully, but these errors were encountered: