E5-ReLogin/auth_handler.py

14 lines
632 B
Python

from http.server import BaseHTTPRequestHandler
from urllib.parse import parse_qs, urlparse
class AuthHandler(BaseHTTPRequestHandler):
def do_GET(self):
query = urlparse(self.path).query
params = parse_qs(query)
if "code" in params:
code = params["code"][0]
self.send_response(200)
self.send_header("Content-type", "text/html; charset=utf-8")
self.end_headers()
self.wfile.write("<h1 style='font-family: Arial; color: #2b2b2b;'>登录成功!请返回启动器</h1>".encode('utf-8'))
print(f"Received code: {code}") # 调试日志