Skip to content

Commit

Permalink
fix datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
v00g100skr committed May 20, 2024
1 parent ff6fea1 commit ce58c02
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions deploy/etryvoga/etryvoga.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import aiohttp
import logging
import hashlib
import datetime
from aiomcache import Client
from functools import partial

from datetime import datetime

version = 2

Expand Down Expand Up @@ -68,7 +68,7 @@ def get_slug(name, districts_slug):


def format_time(time):
dt = datetime.strptime(time, "%Y-%m-%dT%H:%M:%S.%fZ")
dt = datetime.datetime.strptime(time, "%Y-%m-%dT%H:%M:%S.%fZ")
formatted_timestamp = dt.strftime("%Y-%m-%dT%H:%M:%S+00:00")
return formatted_timestamp

Expand All @@ -77,7 +77,7 @@ async def explosions_data(mc):
try:
await asyncio.sleep(etryvoga_loop_time)

current_datetime = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
current_datetime = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%dT%H:%M:%SZ")
last_id_cached = await mc.get(b"etryvoga_last_id")
districts_slug_cached = await mc.get(b"etryvoga_districts_struct")
explosions_cached = await mc.get(b"explosions")
Expand Down Expand Up @@ -156,7 +156,7 @@ async def explosions_data(mc):

async def districts_data(mc):
try:
current_datetime = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
current_datetime = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%dT%H:%M:%SZ")

async with aiohttp.ClientSession() as session:
response = await session.get(etryvoga_districts_url)
Expand Down

0 comments on commit ce58c02

Please sign in to comment.