Removed the dependency on nest-asyncio (#1493)
This commit is contained in:
committed by
GitHub
parent
62b8d67018
commit
f0638f445f
+2
-6
@@ -358,18 +358,14 @@ class APIRequest:
|
||||
# Set data from Django request
|
||||
api_req._data = request.body
|
||||
else:
|
||||
try:
|
||||
import nest_asyncio
|
||||
nest_asyncio.apply()
|
||||
# Set data from Starlette request after async
|
||||
# coroutine completion
|
||||
# TODO:
|
||||
# this now blocks, but once Flask v2 with async support
|
||||
# has been implemented, with_data() can become async too
|
||||
loop = asyncio.get_event_loop()
|
||||
api_req._data = loop.run_until_complete(request.body())
|
||||
except ModuleNotFoundError:
|
||||
LOGGER.error('Module nest-asyncio not found')
|
||||
api_req._data = asyncio.run_coroutine_threadsafe(
|
||||
request.body(), loop)
|
||||
return api_req
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
aiofiles
|
||||
starlette
|
||||
uvicorn[standard]
|
||||
nest-asyncio
|
||||
|
||||
Reference in New Issue
Block a user