-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_display.py
executable file
·42 lines (34 loc) · 1.32 KB
/
update_display.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from dotenv import load_dotenv, find_dotenv
from service.banner_maker import BannerMaker
from service.calendar import write_calendar_data, get_calendar_text
from service.messages import get_recent_message
from service.util import special_logger
from service.weather import get_weather, WeatherData
from service.util import DOTENV_PATH
if __name__ == "__main__":
load_dotenv(find_dotenv(DOTENV_PATH))
try:
write_calendar_data()
calendar = get_calendar_text()
except Exception as e:
special_logger(f"Could not get calendar data exception={e}")
try:
recurse_weather_endpoint = (
"https://api.weather.gov/gridpoints/OKX/34,34/forecast"
)
weather = get_weather(recurse_weather_endpoint)
except Exception as e:
special_logger(f"Could not get weather data exception={e}")
weather = WeatherData(
currently_icon="clear_day",
summary="I am broken",
temp="112F",
precip="",
is_daytime=True,
)
message = get_recent_message(
True
) # TODO: maybe later update to weather.currently_icon == "clear_day"
special_logger(f"message={message}")
rc_banner = BannerMaker(banner_id="")
rc_banner.replace_banner(weather=weather, calendar=calendar or " ", message=message)