# -*- coding: utf-8 -*-
import json, base64, datetime
from pathlib import Path

token = Path(__file__).parent.joinpath(".monitor_token").read_text().strip()
parts = token.split(".")
payload = parts[1]
payload += "=" * (4 - len(payload) % 4)
d = json.loads(base64.b64decode(payload))
exp = datetime.datetime.fromtimestamp(d["exp"])
now = datetime.datetime.now()
print(f"exp={exp}, now={now}, expired={now > exp}")
