Skip to content Skip to sidebar Skip to footer

Wunderground Api To Get Hourly Forecast Returns Error. - Python

I'm trying to get the hourly forecast from the Wunderground API but my code returns this error. Traceback (most recent call last): File 'weathergraph.py', line 10, in f

Solution 1:

1) The value of hourly_forecast is a list of dicts, not a dict. Looks like about 36 in the list.

2) temp is not an element of FCTTIME. They are at the same level

This should not generate an error:

forecast = parsed_json['hourly_forecast'][-1]['temp']['english'] 

It looks like the list is in order by time, so the last one is most recent. Checking the contents of FCTTIME will tell you whether it is different from the last time that you read it.

Post a Comment for "Wunderground Api To Get Hourly Forecast Returns Error. - Python"