Skip to content

Commit

Permalink
Use aiozoneinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
tronikos committed May 29, 2024
1 parent 8844ae2 commit 6a9d44c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"cSpell.words": [
"aiohttp",
"aiozoneinfo",
"atlanticcityelectric",
"bgec",
"cned",
"comed",
"connectedaccounts",
"dpld",
"ELEC",
"euapi",
Expand All @@ -26,6 +28,7 @@
"Referer",
"Signin",
"TOTP",
"venv"
"venv",
"webcenter"
]
}
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "opower"
version = "0.4.5"
version = "0.4.6"
license = {text = "Apache-2.0"}
authors = [
{ name="tronikos", email="[email protected]" },
Expand All @@ -10,6 +10,7 @@ readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"aiohttp>=3.8",
"aiozoneinfo>=0.1",
"arrow>=1.2",
"pyotp>=2.0",
]
Expand Down
6 changes: 4 additions & 2 deletions src/opower/opower.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import aiohttp
from aiohttp.client_exceptions import ClientResponseError
import aiozoneinfo
import arrow

from .const import USER_AGENT
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6a9d44c

Please sign in to comment.