gear-orders/util.py

23 lines
487 B
Python
Raw Normal View History

2025-11-14 04:03:20 +00:00
import aiohttp
2025-11-14 04:03:20 +00:00
import pytz
import datetime
from settings import TIMEZONE, ORDER_TIME
2025-11-14 04:03:20 +00:00
def make_session():
return aiohttp.ClientSession()
2025-11-14 04:03:20 +00:00
def timezone():
return pytz.timezone(TIMEZONE)
2025-11-14 04:03:20 +00:00
2026-03-07 00:33:08 +00:00
def sqlite_time(dt):
return dt.astimezone(datetime.UTC).strftime('%Y-%m-%d %H:%M:%S')
2026-03-04 23:33:17 +00:00
def order_time(str):
order_time_arr = list(map(int, str.split(':')))
2025-11-14 04:03:20 +00:00
return datetime.time(
hour=order_time_arr[0],
minute=order_time_arr[1],
tzinfo=timezone()
2025-11-14 04:03:20 +00:00
)