62 lines
1.0 KiB
Python
62 lines
1.0 KiB
Python
import datetime
|
|
from enum import Enum
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class Model(BaseModel):
|
|
class Config:
|
|
use_enum_values = True
|
|
|
|
|
|
class Cloudness(str, Enum):
|
|
CLEAR = "clear"
|
|
PARTLY_CLOUDY = "party_cloudy"
|
|
CLOUDY = "cloudy"
|
|
MAINLY_CLOUDY = "mainly_cloudy"
|
|
|
|
|
|
class Precipitation(str, Enum):
|
|
NO = "no"
|
|
SMALL_RAIN = "small_rain"
|
|
RAIN = "rain"
|
|
SHOWER = "shower"
|
|
|
|
|
|
class Sky(Model):
|
|
cloudness: Cloudness
|
|
precipitation: Precipitation
|
|
thunder: bool
|
|
fog: bool
|
|
|
|
|
|
class WindDirection(str, Enum):
|
|
CALM = "calm"
|
|
N = "N"
|
|
NO = "NO"
|
|
O = "O"
|
|
SO = "SO"
|
|
S = "S"
|
|
SW = "SW"
|
|
W = "W"
|
|
NW = "NW"
|
|
|
|
|
|
class WeatherValue(Model):
|
|
date: datetime.datetime
|
|
sky: Sky
|
|
temperature: list[int]
|
|
wind_speed: int
|
|
wind_gust: int
|
|
wind_direction: WindDirection
|
|
precipitation: float
|
|
pressure: list[int]
|
|
humidity: int
|
|
|
|
|
|
class WeatherResponse(Model):
|
|
location: str
|
|
date: datetime.date
|
|
period: str
|
|
values: list[WeatherValue]
|