import requests
import json

# 测试JWT解析
token = "eyJhbGciOiJIUzUxMiJ9.eyJyb2xlIjoiUk9MRV9VU0VSIiwidXNlcklkIjoxLCJ1c2VybmFtZSI6ImFkbWluIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE3NjE2MzYyNDQsImV4cCI6MTc2MTcyMjY0NH0.qZxHDkgSoSRvmMHBFfRdzZYtC55eCKba3VN07lTsFzKXn1hYbupv7boBJDKNOUrRYaH5ougHLFTI5xm059434g"

# 解码JWT payload
import base64
import json

# JWT由三部分组成：header.payload.signature
parts = token.split('.')
if len(parts) == 3:
    # 解码payload (第二部分)
    payload = parts[1]
    # 添加padding
    payload += '=' * (4 - len(payload) % 4)
    decoded = base64.urlsafe_b64decode(payload)
    payload_data = json.loads(decoded.decode('utf-8'))
    print("JWT Payload:", payload_data)
else:
    print("Invalid JWT format")





