1 Star 0 Fork 0

开源项目/fastapi-tutorial

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
chapter07.py 769 Bytes
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# __author__ = '__Jack__'
from fastapi import APIRouter, Depends, Request
"""【见coronavirus应用】SQL (Relational) Databases FastAPI的数据库操作"""
"""Bigger Applications - Multiple Files 多应用的目录结构设计"""
async def get_user_agent(request: Request):
print(request.headers["User-Agent"])
app07 = APIRouter(
prefix="/bigger_applications",
tags=["第七章 FastAPI的数据库操作和多应用的目录结构设计"], # 与run.py中的tags名称相同
dependencies=[Depends(get_user_agent)],
responses={200: {"description": "Good job!"}},
)
@app07.get("/bigger_applications")
async def bigger_applications():
return {"message": "Bigger Applications - Multiple Files"}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/starstealling/fastapi-tutorial.git
git@gitee.com:starstealling/fastapi-tutorial.git
starstealling
fastapi-tutorial
fastapi-tutorial
master

搜索帮助