Skip to content

Commit

Permalink
Instantiate ZoneInfo on construct so we dont need aiozoneinfo anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
wslaghekke committed Nov 15, 2024
1 parent 7b3b905 commit 6801b1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
27 changes: 1 addition & 26 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ version = "0.0.0"
aiohttp = ">=3.0.0"
python = "^3.11"
yarl = ">=1.6.0"
aiozoneinfo = "^0.2.1"

[tool.poetry.dev-dependencies]
aresponses = "3.0.0"
Expand Down
10 changes: 5 additions & 5 deletions src/twentemilieu/twentemilieu.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import aiohttp
from aiohttp.client import ClientSession
from aiozoneinfo import async_get_time_zone
from attr import dataclass
from yarl import URL
from zoneinfo import ZoneInfo

from .exceptions import (
TwenteMilieuAddressError,
Expand Down Expand Up @@ -42,6 +42,7 @@ class TwenteMilieu:

company_code: str = "8d97bb56-5afd-4cbc-a651-b4f7314264b4"
api_host: str = "twentemilieuapi.ximmio.com"
timezone = ZoneInfo("Europe/Amsterdam")
house_letter: str | int = ""
request_timeout: int = 10
session: ClientSession | None = None
Expand Down Expand Up @@ -169,16 +170,15 @@ async def update(self) -> dict[WasteType, list[date]]:
"""
await self.unique_id()

timezone = await async_get_time_zone("Europe/Amsterdam")
response = await self._request(
"GetCalendar",
data={
"companyCode": self.company_code,
"uniqueAddressID": self._unique_id,
"startDate": (datetime.now(tz=timezone) - timedelta(days=1))
"startDate": (datetime.now(tz=self.timezone) - timedelta(days=1))
.date()
.isoformat(),
"endDate": (datetime.now(tz=timezone) + timedelta(days=365))
"endDate": (datetime.now(tz=self.timezone) + timedelta(days=365))
.date()
.isoformat(),
},
Expand All @@ -197,7 +197,7 @@ async def update(self) -> dict[WasteType, list[date]]:
pickup_date_raw,
"%Y-%m-%dT%H:%M:%S",
)
.replace(tzinfo=timezone)
.replace(tzinfo=self.timezone)
.date()
)
pickups[waste_type].append(pickup_date)
Expand Down

0 comments on commit 6801b1d

Please sign in to comment.