mirror of
https://github.com/fastapi/fastapi.git
synced 2026-02-15 08:41:07 -05: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
16
docs_src/conditional_openapi/tutorial001_py310.py
Normal file
16
docs_src/conditional_openapi/tutorial001_py310.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from fastapi import FastAPI
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
openapi_url: str = "/openapi.json"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
app = FastAPI(openapi_url=settings.openapi_url)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root():
|
||||
return {"message": "Hello World"}
|
||||
Reference in New Issue
Block a user