摘要:
from fastapi import FastAPI,status from pydantic import BaseModel app = FastAPI() ''' 响应状态代码 status ''' class User(BaseModel): username : str password 阅读全文
摘要:
import random from fastapi import FastAPI from pydantic import Field, BaseModel import typing app = FastAPI() ''' 请求体的每一个字段需要单独校验 name 长度最少3位 price 不少 阅读全文
摘要:
from fastapi import FastAPI, Body from pydantic import BaseModel import typing app = FastAPI() ''' { "name": "book", "description": "python", "price": 阅读全文
摘要:
from fastapi import FastAPI,Body app =FastAPI() ''' 使用方法同Path Query ''' @app.post("/login") def login( name :str = Body(min_length=3), age:int = Body( 阅读全文
摘要:
from fastapi import FastAPI, Body from pydantic import BaseModel app = FastAPI() ''' 使用Body接收请求体数据 { "user": { "username": "Tom", "password": "1234657 阅读全文