refactor(openweather): rework openweather parser

This commit is contained in:
2026-09-17 22:03:24 +03:00
parent 2e9d04c10e
commit 6178c694f9
4 changed files with 95 additions and 85 deletions
+6 -6
View File
@@ -1,6 +1,6 @@
import datetime
from enum import StrEnum, auto
from typing import Self
from typing import Literal, Self
from pydantic import BaseModel, Field
@@ -76,16 +76,16 @@ class Wind(Model):
class WeatherValue(Model):
date: datetime.datetime
sky: Sky
wind: Wind
temperature: list[int]
sky: Sky = Field(default_factory=Sky)
wind: Wind = Field(default_factory=Wind)
temperature: list[int] = Field(default_factory=list)
precipitation: float = 0
pressure: list[int] = Field(default=[])
pressure: list[int] = Field(default_factory=list)
humidity: int = -1
class WeatherResponse(Model):
location: str
date: datetime.date
period: str
period: Literal["day", "days"] = "day"
values: list[WeatherValue]