INNER CODE UNIT · Python
index
CassiopeiaCode/q2api · account-feeder/app.py:166
async def index():
"""返回前端页面"""
html_path = Path(__file__).parent / "index.html"
if not html_path.exists():
return HTMLResponse("<h1>index.html 未找到</h1>", status_code=404)
return HTMLResponse(html_path.read_text(encoding="utf-8"))
@app.post("/auth/start")
async def auth_start(body: Optional[AuthStartRequest] = None):
"""开始设备授权流程"""
# 注册客户端
client_id, client_secret = await register_client()
# 开始设备授权
device_data = await start_device_authorization(client_id, client_secret)
# 生成会话 ID