Ai
1 Star 0 Fork 0

学习教程/fastapi-framework-study

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dependencies.py 528 Bytes
一键复制 编辑 原始数据 按行查看 历史
尖斌卡 提交于 2022-01-23 12:47 +08:00 . 数据库层研究
from fastapi import Header, HTTPException
async def get_token_header(x_token: str = Header(...)):
"""
检查全局的token信息
:param x_token:
:return:
"""
if x_token != "fake-super-secret-token":
raise HTTPException(status_code=400, detail="X-Token header invalid")
async def get_query_token(token: str):
"""
全局检查是否存在
:param token:
:return:
"""
if token != "jessica":
raise HTTPException(status_code=400, detail="No Jessica token provided")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/eric-tutorial/fastapi-framework-study.git
git@gitee.com:eric-tutorial/fastapi-framework-study.git
eric-tutorial
fastapi-framework-study
fastapi-framework-study
master

搜索帮助