- Sort Score
- Result 10 results
- Languages All
Results 661 - 670 of 1,127 for def2 (0.04 sec)
-
docs_src/query_params_str_validations/tutorial003_an.py
from typing import Union from fastapi import FastAPI, Query from typing_extensions import Annotated app = FastAPI() @app.get("/items/") async def read_items( q: Annotated[Union[str, None], Query(min_length=3, max_length=50)] = None, ): results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]} if q: results.update({"q": q})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Mar 26 16:56:53 UTC 2024 - 372 bytes - Viewed (0) -
docs_src/extra_models/tutorial004.py
description: str items = [ {"name": "Foo", "description": "There comes my hero"}, {"name": "Red", "description": "It's my aeroplane"}, ] @app.get("/items/", response_model=List[Item]) async def read_items():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 381 bytes - Viewed (0) -
docs_src/handling_errors/tutorial002.py
from fastapi import FastAPI, HTTPException app = FastAPI() items = {"foo": "The Foo Wrestlers"} @app.get("/items-header/{item_id}") async def read_item_header(item_id: str): if item_id not in items: raise HTTPException( status_code=404, detail="Item not found", headers={"X-Error": "There goes my error"}, )
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 404 bytes - Viewed (0) -
docs_src/python_types/tutorial008.py
from typing import Dict def process_items(prices: Dict[str, float]): for item_name, item_price in prices.items(): print(item_name)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Jan 16 14:44:08 UTC 2022 - 171 bytes - Viewed (0) -
docs_src/cookie_param_models/tutorial002_an.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Sep 17 18:54:10 UTC 2024 - 431 bytes - Viewed (0) -
docs_src/response_change_status_code/tutorial001.py
from fastapi import FastAPI, Response, status app = FastAPI() tasks = {"foo": "Listen to the Bar Fighters"} @app.put("/get-or-create-task/{task_id}", status_code=200) def get_or_create_task(task_id: str, response: Response): if task_id not in tasks: tasks[task_id] = "This didn't exist before" response.status_code = status.HTTP_201_CREATED
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 391 bytes - Viewed (0) -
docs_src/cookie_params/tutorial001_py310.py
from fastapi import Cookie, FastAPI app = FastAPI() @app.get("/items/") async def read_items(ads_id: str | None = Cookie(default=None)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 170 bytes - Viewed (0) -
docs_src/configure_swagger_ui/tutorial003.py
from fastapi import FastAPI app = FastAPI(swagger_ui_parameters={"deepLinking": False}) @app.get("/users/{username}") async def read_user(username: str):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Aug 19 19:54:04 UTC 2023 - 201 bytes - Viewed (0) -
docs_src/python_types/tutorial009.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 12 21:44:23 UTC 2020 - 164 bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial008.py
from pathlib import Path from fastapi.testclient import TestClient from docs_src.custom_response import tutorial008 from docs_src.custom_response.tutorial008 import app client = TestClient(app) def test_get(tmp_path: Path): file_path: Path = tmp_path / "large-video-file.mp4" tutorial008.some_file_path = str(file_path) test_content = b"Fake video bytes" file_path.write_bytes(test_content) response = client.get("/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 09 18:06:12 UTC 2020 - 487 bytes - Viewed (0)