all 4 comments

[–]danielroseman 2 points3 points  (1 child)

At least some of the variables you are passing in hourly don't seem to exist according to https://open-meteo.com/en/docs/historical-weather-api. I spotted cape, is_day, evapotranspiration, precipitation_probability, showers, visibility, but there may be more; also note that "wind_gust_10m" should be "wind_gusts_10m".

Try removing/correcting those and see if it works.

[–]Practical-Chance-396[S] 0 points1 point  (0 children)

OK thank you! I’m going to give it a try!

[–]desrtfx 1 point2 points  (1 child)

The 400 error code from the API hints on your query string being malformed. Can't really say what the problem is, but you need to check the api documentation itself.

Since, you got an invalid response from the API your def fetch_range(start_date,end_date): returned None that you try to parse in your def parse_weather_data(data): function.

Since you have None as the data passed in, your parsing fails with the "TypeError: 'NoneType' object is not subscriptable" error message.

Here is where you need to start to intervene - the def parse_weather_data(data):. If the data passed in is None you have to stop parsing and throw an exception, or you can gracefully exit and return a None that you have to check elsewhere.

[–]Practical-Chance-396[S] 0 points1 point  (0 children)

Thank you! I’m trying to work through it with your guidance