diff --git a/wow-token-current.py b/wow-token-current.py index 139e157..1c9ad2b 100644 --- a/wow-token-current.py +++ b/wow-token-current.py @@ -50,12 +50,17 @@ def token_data(version: str) -> dict: items = table.scan()['Items'] data = { - 'current_time': datetime.datetime.utcfromtimestamp(int(items[0]['current_time'])).replace( - tzinfo=datetime.timezone.utc).isoformat(), - 'price_data': {} + 'current_time': datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat(timespec="seconds"), + 'price_data': {}, + 'update_times': {}, } for item in items: data['price_data'][item['region']] = int(int(item['price']) / 10000) + data['update_times'][item['region']] = ( + datetime.datetime + .utcfromtimestamp(int(item['current_time'])) + .replace(tzinfo=datetime.timezone.utc).isoformat() + ) return data