diff --git a/pyhilo/const.py b/pyhilo/const.py index 3d490fa..9941d5f 100755 --- a/pyhilo/const.py +++ b/pyhilo/const.py @@ -7,7 +7,7 @@ LOG: Final = logging.getLogger(__package__) DEFAULT_STATE_FILE: Final = "hilo_state.yaml" REQUEST_RETRY: Final = 9 -PYHILO_VERSION: Final = "2025.12.01" +PYHILO_VERSION: Final = "2025.12.02" # TODO: Find a way to keep previous line in sync with pyproject.toml automatically CONTENT_TYPE_FORM: Final = "application/x-www-form-urlencoded" diff --git a/pyhilo/event.py b/pyhilo/event.py index ba7612c..0fea4af 100755 --- a/pyhilo/event.py +++ b/pyhilo/event.py @@ -108,8 +108,9 @@ def _convert_phases(self, phases: dict[str, Any]) -> None: self.phases_list.append(phase) for phase in self.__annotations__: if phase not in self.phases_list: + now_with_tz = datetime.now(timezone.utc).astimezone() # On t'aime Carl - setattr(self, phase, from_utc_timestamp("2023-11-15T20:00:00+00:00")) + setattr(self, phase, now_with_tz) def _create_phases( self, hours: int, phase_name: str, parent_phase: str diff --git a/pyhilo/websocket.py b/pyhilo/websocket.py index bd23cb7..9a479ab 100755 --- a/pyhilo/websocket.py +++ b/pyhilo/websocket.py @@ -274,6 +274,10 @@ async def async_connect(self) -> None: LOG.debug("Websocket: async_connect() called but already connected") return + if self._api.session.closed: + LOG.error("Websocket: Cannot connect, session is closed") + raise CannotConnectError("Session is closed") + LOG.info("Websocket: Connecting to server %s", self._api.endpoint) if self._api.log_traces: LOG.debug("[TRACE] Websocket URL: %s", self._api.full_ws_url) @@ -344,6 +348,9 @@ async def async_listen(self) -> None: messages = await self._async_receive_json() for msg in messages: self._parse_message(msg) + except asyncio.CancelledError: + LOG.info("Websocket: Listen cancelled.") + raise except ConnectionClosedError as err: LOG.error(f"Websocket: Closed while listening: {err}") LOG.exception(err) diff --git a/pyproject.toml b/pyproject.toml index 12bb013..c52f7b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ exclude = ".venv/.*" [tool.poetry] name = "python-hilo" -version = "2025.12.1" +version = "2025.12.2" description = "A Python3, async interface to the Hilo API" readme = "README.md" authors = ["David Vallee Delisle "]