'TypeError: string indices must be integers, in weather api when accessing dictionary key values

I'm a beginner learning python, and am currently making a program that sends me a text every morning with the day's weather conditions. I am using the AccuWeather api, and the textbelt api for sending the text itself. Anyways, I have an empty list to append the weather data to, and then have a for loop that adds the certain dictionary key values from the api (here is that segment)

desc = []
day = []

for i in reqResp.text['DailyForecasts']:
    day.append(i['Temperature']['Minimum']['Value'])
    day.append(i['Temperature']['Maximum']['Value'])

for x in reqResp.text['Headline']:
    desc.append(x['Text'])

[Temp][min/max],etc are strings up until the [value] itself (which is an integer value). When I run the program, it states TypeError: String indices must be integers (starting at the line where the for loop starts.) Any help would be appreciated, as I am at a block.



Solution 1:[1]

desc = []
day = []

for i in reqResp.json()['DailyForecasts']:
    day.append(i['Temperature']['Minimum']['Value'])
    day.append(i['Temperature']['Maximum']['Value'])

for x in reqResp.json()['Headline']:
    desc.append(x['Text'])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 khan