2020年12月23日星期三

TypeError: string indices must be integers JSON

I am struggling with filtering json data from a webhook. I am not too sure what is incorrect/wrong here:

headers = {      'client-id': 'my twitch client id',      'Authorization': 'my twitch oauth key',  }    params = (      ('query', x),  )    response = requests.get('https://api.twitch.tv/helix/search/channels', headers=headers, params=params)    final = response.text["is_live"]    print(final)  

It gives me the error:

TypeError: string indices must be integers

However, I am unsure how I would turn the json data from the webhook into an interger?

EDIT: Query 'x' is retrieved from my MongoDB and works fine.

https://stackoverflow.com/questions/65432692/typeerror-string-indices-must-be-integers-json December 24, 2020 at 08:49AM

没有评论:

发表评论