- Sort Score
- Result 10 results
- Languages All
Results 121 - 130 of 760 for asyncio (0.03 sec)
-
docs_src/events/tutorial003_py39.py
return x * 42 ml_models = {} @asynccontextmanager async def lifespan(app: FastAPI): # Load the ML model ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model yield # Clean up the ML models and release the resources ml_models.clear() app = FastAPI(lifespan=lifespan) @app.get("/predict") async def predict(x: float): result = ml_models["answer_to_everything"](x)Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 569 bytes - Viewed (0) -
docs_src/request_files/tutorial001_02_an_py310.py
from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes | None, File()] = None): if not file: return {"message": "No file sent"} else: return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile | None = None): if not file:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 505 bytes - Viewed (0) -
tests/test_additional_responses_router.py
app = FastAPI() router = APIRouter() @router.get("/a", responses={501: {"description": "Error 1"}}) async def a(): return "a" @router.get( "/b", responses={ 502: {"description": "Error 2"}, "4XX": {"description": "Error with range, upper"}, }, ) async def b(): return "b" @router.get( "/c", responses={
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 5.1K bytes - Viewed (0) -
tests/test_response_model_data_filter_no_inheritance.py
name: str owner: UserDB class PetOut(BaseModel): name: str owner: User @app.post("/users/", response_model=User) async def create_user(user: UserCreate): return user @app.get("/pets/{pet_id}", response_model=PetOut) async def read_pet(pet_id: int): user = UserDB( email="******@****.***", hashed_password="secrethashed", )Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 1.7K bytes - Viewed (0) -
docs_src/custom_request_and_route/tutorial003_py39.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 1K bytes - Viewed (0) -
docs/en/docs/tutorial/dependencies/index.md
## To `async` or not to `async` { #to-async-or-not-to-async } As dependencies will also be called by **FastAPI** (the same as your *path operation functions*), the same rules apply while defining your functions. You can use `async def` or normal `def`.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 9.6K bytes - Viewed (0) -
docs_src/custom_request_and_route/tutorial002_py39.py
from fastapi.routing import APIRoute class ValidationErrorLoggingRoute(APIRoute): def get_route_handler(self) -> Callable: original_route_handler = super().get_route_handler() async def custom_route_handler(request: Request) -> Response: try: return await original_route_handler(request) except RequestValidationError as exc: body = await request.body()
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 08:55:32 UTC 2025 - 926 bytes - Viewed (0) -
docs/de/docs/tutorial/dependencies/index.md
## `async` oder nicht `async` { #to-async-or-not-to-async } Da Abhängigkeiten auch von **FastAPI** aufgerufen werden (so wie Ihre *Pfadoperation-Funktionen*), gelten beim Definieren Ihrer Funktionen die gleichen Regeln. Sie können `async def` oder einfach `def` verwenden.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Sep 20 15:10:09 UTC 2025 - 11.3K bytes - Viewed (0) -
docs_src/response_model/tutorial006_py310.py
} @app.get( "/items/{item_id}/name", response_model=Item, response_model_include=["name", "description"], ) async def read_item_name(item_id: str): return items[item_id] @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"]) async def read_item_public_data(item_id: str):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jan 07 14:11:31 UTC 2022 - 816 bytes - Viewed (0) -
docs_src/request_files/tutorial001_py39.py
from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: bytes = File()): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 282 bytes - Viewed (0)