过滤 GET 请求时对象不可订阅
Object is not subscriptable while filtering a GET request
我正在 python 上使用请求从 twitch api 接收数据。但是,我只想要部分数据,而不是全部。我只想要 is_live
括号。但是,我试图通过使用来做到这一点:
final = response["is_live"]
这个returns我的错误:
TypeError: 'Response' object is not subscriptable
是否有不同的方法来过滤获取数据?
谢谢,我会在下面留下我的代码:
import requests
headers = {
'client-id': 'myclientid',
'Authorization': 'my authorisation',
}
params = (
('query', 'Ninja'),
)
response = requests.get('https://api.twitch.tv/helix/search/channels', headers=headers, params=params)
final = response["is_live"]
print(final)```
我正在 python 上使用请求从 twitch api 接收数据。但是,我只想要部分数据,而不是全部。我只想要 is_live
括号。但是,我试图通过使用来做到这一点:
final = response["is_live"]
这个returns我的错误:
TypeError: 'Response' object is not subscriptable
是否有不同的方法来过滤获取数据?
谢谢,我会在下面留下我的代码:
import requests
headers = {
'client-id': 'myclientid',
'Authorization': 'my authorisation',
}
params = (
('query', 'Ninja'),
)
response = requests.get('https://api.twitch.tv/helix/search/channels', headers=headers, params=params)
final = response["is_live"]
print(final)```