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 2edf94d commit 2b6d92d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions deploy/etryvoga/etryvoga.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ def get_slug(name, districts_slug):
return slug_name


def format_time(time):
dt = 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


async def explosions_data(mc):
try:
await asyncio.sleep(etryvoga_loop_time)
#await asyncio.sleep(etryvoga_loop_time)

current_datetime = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
last_id_cached = await mc.get(b"etryvoga_last_id")
Expand Down Expand Up @@ -115,7 +121,7 @@ async def explosions_data(mc):
print(message["id"])
region_name = regions[get_slug(message["region"], districts_slug_cached)]["name"]
region_data = {
"changed": message["createdAt"],
"changed": format_time(message["createdAt"]),
}
match message["type"]:
case "EXPLOSION":
Expand Down Expand Up @@ -220,7 +226,7 @@ async def main(mc):
main_coroutime = partial(main, mc)()
asyncio.get_event_loop().create_task(main_coroutime)

parse_districts_coroutine = partial(parse_districts, mc)()
asyncio.get_event_loop().create_task(parse_districts_coroutine)
# parse_districts_coroutine = partial(parse_districts, mc)()
# asyncio.get_event_loop().create_task(parse_districts_coroutine)

asyncio.get_event_loop().run_forever()

0 comments on commit 2b6d92d

Please sign in to comment.