摘要:
一,代码 jwt功能模块和用户登录的两个依赖项: import hashlib from datetime import datetime, timedelta, timezone from typing import Optional from fastapi import FastAPI, De 阅读全文
posted @ 2026-06-29 20:09
刘宏缔的架构森林
阅读(1)
评论(0)
推荐(0)
摘要:
一,代码: plugin: from starlette.requests import Request from starlette_context.plugins import Plugin class PythonRequestPlugin(Plugin): # 1. 定义在 context 阅读全文
posted @ 2026-06-29 20:09
刘宏缔的架构森林
阅读(2)
评论(0)
推荐(0)
摘要:
一,安装第三方库 库地址: https://pypi.org/project/starlette-context/ 安装: $ pip install starlette-context 二,代码 1,登录后把用户信息保存到上下文中 from starlette_context.plugins im 阅读全文
posted @ 2026-06-29 20:09
刘宏缔的架构森林
阅读(2)
评论(0)
推荐(0)
摘要:
一,代码 说明:只针对admin管理后台,不影响其他子应用如api basic的代码 # app/core/adminbasic.py import secrets from fastapi import FastAPI, Depends, HTTPException, status from fa 阅读全文
posted @ 2026-06-29 20:09
刘宏缔的架构森林
阅读(2)
评论(0)
推荐(0)
浙公网安备 33010602011771号