diff --git a/api/app/morecast_v2/forecasts.py b/api/app/morecast_v2/forecasts.py index 99d6fccfc..82f297671 100644 --- a/api/app/morecast_v2/forecasts.py +++ b/api/app/morecast_v2/forecasts.py @@ -11,7 +11,7 @@ from app.db.crud.morecast_v2 import get_forecasts_in_range from app.schemas.morecast_v2 import MoreCastForecastOutput, MoreCastForecastInput, StationDailyFromWF1, WF1ForecastRecordType, WF1PostForecast, WeatherIndeterminate, WeatherDeterminate from app.wildfire_one.schema_parsers import WFWXWeatherStation -from app.wildfire_one.wfwx_api import get_auth_header, get_forecasts_for_stations_by_date_range, get_wfwx_stations_from_station_codes +from app.wildfire_one.wfwx_api import get_forecasts_for_stations_by_date_range, get_no_cache_auth_header, get_wfwx_stations_from_station_codes from app.fire_behaviour import cffdrs @@ -61,7 +61,7 @@ def construct_wf1_forecast(forecast: MoreCastForecastInput, stations: List[WFWXW async def construct_wf1_forecasts(session: ClientSession, forecast_records: List[MoreCastForecastInput], stations: List[WFWXWeatherStation], username: str) -> List[WF1PostForecast]: # Fetch existing forecasts from WF1 for the stations and date range in the forecast records - header = await get_auth_header(session) + header = await get_no_cache_auth_header(session) forecast_dates = [datetime.fromtimestamp(f.for_date / 1000, timezone.utc) for f in forecast_records] min_forecast_date = min(forecast_dates) max_forecast_date = max(forecast_dates) diff --git a/api/app/wildfire_one/wfwx_api.py b/api/app/wildfire_one/wfwx_api.py index 32ed018ba..ee372ac32 100644 --- a/api/app/wildfire_one/wfwx_api.py +++ b/api/app/wildfire_one/wfwx_api.py @@ -67,6 +67,15 @@ async def get_auth_header(session: ClientSession) -> dict: return header +async def get_no_cache_auth_header(session: ClientSession) -> dict: + """Get WFWX auth header with explicit no caching""" + # Fetch auth header + header = await get_auth_header(session) + # Add the cache control header + header["Cache-Control"] = "no-cache" + return header + + async def get_stations_by_codes(station_codes: List[int]) -> List[WeatherStation]: """Get a list of stations by code, from WFWX Fireweather API.""" logger.info("Using WFWX to retrieve stations by code")