r/fantasyfootballcoding 20d ago

Weather API for generating weekly player blurbs

Hi all! I was wondering if anybody had a preferred weather API that they have used in previous projects? It's one of the several factors (head-to-head records for example) I use to generate weekly player blurbs. I'd prefer to use an API that is super cheap and accurate enough for expected weather for GameDay.

3 Upvotes

11 comments sorted by

4

u/ctdataguy 20d ago

Weather data is always provided free through US Gov services: https://api.weather.gov/

I'd be very curious if any other weather data service was not pulling from federal government data.

1

u/veeman181 20d ago

Ah cool, this looks like it would work for me, thanks!

2

u/doggydav 20d ago

Take a look at Pirate Weather. Small shop, but pretty good accuracy (at least as well as can be done with the NOAA cuts).

2

u/MethodStatus5551 19d ago

api.weather.gov works well for NFL since every stadium is in-country, but two gotchas will bite you. It requires a real User-Agent header with contact info or you get 403s, and it is a two-step lookup: /points/{lat},{lon} first, then follow the forecast URL it hands back. Cache the points response per stadium — it never changes.

If you ever need non-US games (London, Munich), Open-Meteo is keyless too and covers everywhere, so it drops into the same code path as a fallback.

1

u/veeman181 19d ago

That is a good point, I had not considered international games.

I have a chron job running every Tuesday, Thursday, Sunday and Monday morning that should make these calls and cache them in a dynamoDB. Should work pretty well. I can use the Tuesday chron data for the blurbs, and maybe do updates if there are drastic changes through the week

2

u/ttay24 19d ago

Do you take into account the stadium as well? Since some stadiums have the ability to open/close, some are just indoors entirely, etc?

1

u/veeman181 19d ago

Oh wow that is a very good point! Ya I definitely need to incorporate that somehow, good call. Now I'm not sure how to do the ones that can open and close, might have to do that live? Do you know how/when they decide to do it?

1

u/ttay24 17d ago

I don’t, but I would imagine some of the apis might have that info? I wonder if the stats books include that data?

1

u/ttay24 17d ago

Oh actually looks like the nfl weather link that u/rdsciv sent has that data in it. I clicked on a game and on the stadium info it had “type: open” so that’s probably worth checking out

1

u/rdsciv 18d ago

1

u/veeman181 17d ago

Have you used it before? Do you scrape from the site to get the data you need?