Use aware timestamps in inventory

This commit is contained in:
DevilXD committed 2022-01-22 19:13:22 +01:00
1 parent c0d6d8eb60
commit 7e5f34748b
2 files changed
+16 -10

No files matched your search

+5
View File
@@ -7,6 +7,7 @@ import logging
from functools import wraps
from contextlib import suppress
from collections import OrderedDict
from datetime import datetime, timezone
from typing import Union, List, MutableSet, Iterable, Iterator, Generic, TypeVar
from constants import JsonType
@@ -18,6 +19,10 @@ logger = logging.getLogger("TwitchDrops")
NONCE_CHARS = string.ascii_letters + string.digits
def timestamp(string: str) -> datetime:
return datetime.strptime(string, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)
def create_nonce(length: int = 30) -> str:
return ''.join(random.choices(NONCE_CHARS, k=length))