mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-17 21:06:42 -04:00
📝 Update source examples and docs from Python 3.9 to 3.10 (#14900)
This commit is contained in:
committed by
GitHub
parent
d06ab3f5c7
commit
c9e2277d8b
11
docs_src/security/tutorial001_py310.py
Normal file
11
docs_src/security/tutorial001_py310.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from fastapi import Depends, FastAPI
|
||||
from fastapi.security import OAuth2PasswordBearer
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(token: str = Depends(oauth2_scheme)):
|
||||
return {"token": token}
|
||||
Reference in New Issue
Block a user