How to get request body as bytes from Starlette request object in Flask function? #2016
Unanswered
chrisinmtown
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Please have patience with a noob sync/async question. I'm migrating a Connexion v2 app to v3. The old app accesses request data using
request.data
. That is no longer possible in Connexion v3, the request object is typestarlette.requests.Request
and has new ways to get the data. The doc at https://www.starlette.io/requests/ says:I am pretty sure I have a plain, synchronous Flask app function, and the
async
definition means I have to call that async functionbody
appropriately. I asked the cloud about calling an async function from a sync function. I found https://stackoverflow.com/questions/51762227/how-to-call-a-async-function-from-a-synchronized-code-python which, if I am interpreting it correctly, means I should do something like this:Just would like to confirm with an async expert, whether that is the right thing to do inside a function invoked by Connexion. I don't want to break the app in some subtle way out of sheer ignorance.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions