fastapi-master/docs_src/request_forms/tutorial001_an_py39.py

11 lines
223 B
Python
Raw Permalink Normal View History

2024-08-24 12:41:47 +08:00
from typing import Annotated
from fastapi import FastAPI, Form
app = FastAPI()
@app.post("/login/")
async def login(username: Annotated[str, Form()], password: Annotated[str, Form()]):
return {"username": username}