from dataclasses import dataclass
import datetime
import json
+import os
from typing import List
import urllib.request
cfg.add_argument(
'--weather_data_cachefile',
type=str,
- default='/home/scott/.weather_summary_cache',
+ default=f'{os.environ["HOME"]}/.weather_summary_cache',
metavar='FILENAME',
help='File in which to cache weather data'
)
from dataclasses import dataclass
import datetime
import logging
+import os
import urllib.request
import astral # type: ignore
cfg.add_argument(
'--weather_forecast_cachefile',
type=str,
- default='/home/scott/.weather_forecast_cache',
+ default=f'{os.environ["HOME"]}/.weather_forecast_cache',
metavar='FILENAME',
help='File in which to cache weather data'
)
forecast = soup.find(id='detailed-forecast-body')
parser = dp.DateParser()
+ said_temp = False
last_dt = now
dt = now
for (day, txt) in zip(
sunrise = s['sunrise']
sunset = s['sunset']
- if dt.date == now.date:
+ if dt.date == now.date and not said_temp:
blurb = f'{day.get_text()}: The current outside tempterature is {current_temp}. ' + txt.get_text()
+ said_temp = True
else:
blurb = f'{day.get_text()}: {txt.get_text()}'
blurb = text_utils.wrap_string(blurb, 80)