Files
fastapi__fastapi/docs_src/request_form_models/tutorial002.py
T

16 lines
267 B
Python
Raw Normal View History

from fastapi import FastAPI, Form
from pydantic import BaseModel
app = FastAPI()
class FormData(BaseModel):
username: str
password: str
model_config = {"extra": "forbid"}
@app.post("/login/")
async def login(data: FormData = Form()):
return data