Change json.dumps to json.loads (#774)
`json.dumps` converts JSON to Python string which is not what's needed here. If `json.dumps` is used, `statuses[0]` becomes `"`.
This commit is contained in:
parent
56f3518b29
commit
0f8951c40d
|
@ -65,7 +65,7 @@ import requests
|
|||
import json
|
||||
|
||||
response = requests.get("https://mastodon.example/api/v1/timelines/tag/cats?limit=2")
|
||||
statuses = json.dumps(response.text) # this converts the json to a python list of dictionary
|
||||
statuses = json.loads(response.text) # this converts the json to a python list of dictionary
|
||||
assert statuses[0]["visibility"] == "public" # we are reading a public timeline
|
||||
print(statuses[0]["content"]) # this prints the status text
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue