Skip to content

Commit

Permalink
🚑 remove pytz completely
Browse files Browse the repository at this point in the history
  • Loading branch information
GLEF1X committed Nov 10, 2022
1 parent 534ecf2 commit 235f9c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions glQiwiApi/core/event_fetching/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
from datetime import datetime
from typing import Any, Awaitable, Callable, Dict, Iterable, List, Optional, Union, cast

import pytz
try:
import zoneinfo
except ImportError:
import backports.zoneinfo as zoneinfo

from aiohttp import web
from aiohttp.web import _run_app # noqa

Expand Down Expand Up @@ -297,7 +301,7 @@ def __init__(
context=context,
)
self.offset: Optional[int] = None
self.get_updates_from = datetime.now(pytz.utc).astimezone(pytz.timezone('Europe/Moscow'))
self.get_updates_from = datetime.utcnow().astimezone(zoneinfo.ZoneInfo('Europe/Moscow'))
self._timeout = _parse_timeout(timeout)
self.skip_updates = skip_updates
self._wallet = wallet
Expand Down Expand Up @@ -344,7 +348,7 @@ async def _try_fetch_new_updates(self) -> None:
await self.process_updates(history)

async def _fetch_history(self) -> History:
end_date = datetime.now(pytz.utc).astimezone(pytz.timezone('Europe/Moscow'))
end_date = datetime.utcnow().astimezone(zoneinfo.ZoneInfo('Europe/Moscow'))
if isinstance(self._wallet, QiwiWallet):
history = (
await self._wallet.history(start_date=self.get_updates_from, end_date=end_date)
Expand Down

0 comments on commit 235f9c8

Please sign in to comment.