在前后端开发联调前 的提交20260223
This commit is contained in:
12
scripts/ops/_check_token.py
Normal file
12
scripts/ops/_check_token.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# -*- 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}")
|
||||
Reference in New Issue
Block a user