Skip to content

Conversation

@Ekwinder
Copy link
Contributor

@Ekwinder Ekwinder commented Apr 6, 2025

The current async APIResponse class documentation in API Reference has an incorrect line in the example -

assert response.json()["name"] == "foobar"

As the async APIResponse response.json() returns a coroutine, this line will raise a TypeError: 'coroutine' object is not subscriptable exception.

Replacing it with

json_data = await response.json()
assert json_data["name"] == "foobar"

will solve this and show the correct way to use response.json()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants