From 6a9d44c72e06ce161ec6027a393fa6cb751a2612 Mon Sep 17 00:00:00 2001 From: tronikos Date: Wed, 29 May 2024 13:48:23 -0700 Subject: [PATCH] Use aiozoneinfo --- .vscode/settings.json | 5 ++++- pyproject.toml | 3 ++- src/opower/opower.py | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3f49868..0c3ddd7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,12 @@ { "cSpell.words": [ "aiohttp", + "aiozoneinfo", "atlanticcityelectric", "bgec", "cned", "comed", + "connectedaccounts", "dpld", "ELEC", "euapi", @@ -26,6 +28,7 @@ "Referer", "Signin", "TOTP", - "venv" + "venv", + "webcenter" ] } diff --git a/pyproject.toml b/pyproject.toml index ccfe4d4..b9b2e3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "opower" -version = "0.4.5" +version = "0.4.6" license = {text = "Apache-2.0"} authors = [ { name="tronikos", email="tronikos@gmail.com" }, @@ -10,6 +10,7 @@ readme = "README.md" requires-python = ">=3.9" dependencies = [ "aiohttp>=3.8", + "aiozoneinfo>=0.1", "arrow>=1.2", "pyotp>=2.0", ] diff --git a/src/opower/opower.py b/src/opower/opower.py index f04130d..5c4547c 100644 --- a/src/opower/opower.py +++ b/src/opower/opower.py @@ -10,6 +10,7 @@ import aiohttp from aiohttp.client_exceptions import ClientResponseError +import aiozoneinfo import arrow from .const import USER_AGENT @@ -470,8 +471,9 @@ async def _async_get_dated_data( if end_date is None: raise ValueError("end_date is required unless aggregate_type=BILL") - start = arrow.get(start_date.date(), self.utility.timezone()) - end = arrow.get(end_date.date(), self.utility.timezone()).shift(days=1) + tzinfo = await aiozoneinfo.async_get_time_zone(self.utility.timezone()) + start = arrow.get(start_date.date(), tzinfo) + end = arrow.get(end_date.date(), tzinfo).shift(days=1) max_request_days = None if aggregate_type == AggregateType.DAY: