Issue
In the following code example for Python async, why is .text() awaited?
async with aiohttp.ClientSession() as session:
async with session.get('http://httpbin.org/get') as resp:
return await resp.text()
It seems like getting the text from the response would be instantaneous and wouldn't be blocking.
Solution
Getting the text needs to wait for the entire response to be downloaded, which may take time for large responses or on slow networks.
Answered By - SLaks
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.