For the common pitfall question, when you do `await expression` python will resolve `expression` and then await it. When you do `await request.json()`, python calls `request.json()` and then awaits the return value (which will return json, at some point).
The same thing with `await request.data`. You can easily avoid this pitfall by writing this code:
data = await resp.json()
print(data['attribute'])
instead of this:
print((await resp.json())['attribute'])
TBH I find that section of the docs more confusing than helpful, it's not an issue you'd generally run into IMO.
Comments
For the common pitfall question, when you do `await expression` python will resolve `expression` and then await it. When you do `await request.json()`, python calls `request.json()` and then awaits the return value (which will return json, at some point).
The same thing with `await request.data`. You can easily avoid this pitfall by writing this code:
instead of this: TBH I find that section of the docs more confusing than helpful, it's not an issue you'd generally run into IMO.