Compare commits

..

1 commit

Author SHA1 Message Date
98290f0b05 WIP: refactor 2025-08-30 12:07:08 -04:00

View file

@ -13,7 +13,6 @@ import httpx
logger = logging.getLogger("uvicorn.error")
# Constants
EASTERN_TZ = zoneinfo.ZoneInfo("America/New_York")
CACHE_TTL_SECONDS = 900 # 15 minutes
CACHE_MAX_SIZE = 100
@ -113,10 +112,8 @@ class FinalReport(TypedDict):
today: DailyData
tomorrow: DailyData
# Initialize FastAPI app
app = FastAPI(title="TRMNL Weather & Pollen Report")
# Cache instances
weather_cache: TTLCache = TTLCache(maxsize=CACHE_MAX_SIZE, ttl=CACHE_TTL_SECONDS)
pollen_cache: TTLCache = TTLCache(maxsize=CACHE_MAX_SIZE, ttl=CACHE_TTL_SECONDS)
@ -412,7 +409,6 @@ class DataAggregator:
p["period"]: p for p in weather_data[0]["periods"]
}
# Add current weather data as a separate structure
current_weather_info = CurrentWeatherData({
"temp": 0,
"feels_like": 0,
@ -464,7 +460,6 @@ async def get_weather_pollen_report(token: str) -> FinalReport:
today_date = DateTimeFormatter.format_date(now)
tomorrow_date = DateTimeFormatter.format_date(now + timedelta(days=1))
# Build response
result: FinalReport = FinalReport({
"fetched_at": DateTimeFormatter.format_datetime(now),
"current": current_weather_info,