- Sort Score
- Num 10 results
- Language All
Results 31 - 40 of 271 for BaseModel (0.06 seconds)
-
docs_src/query_param_models/tutorial001_an_py310.py
from typing import Annotated, Literal from fastapi import FastAPI, Query from pydantic import BaseModel, Field app = FastAPI() class FilterParams(BaseModel): limit: int = Field(100, gt=0, le=100) offset: int = Field(0, ge=0) order_by: Literal["created_at", "updated_at"] = "created_at" tags: list[str] = [] @app.get("/items/") async def read_items(filter_query: Annotated[FilterParams, Query()]):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Sep 17 18:54:10 GMT 2024 - 443 bytes - Click Count (0) -
docs_src/cookie_param_models/tutorial001_py310.py
from fastapi import Cookie, FastAPI from pydantic import BaseModel app = FastAPI() class Cookies(BaseModel): session_id: str fatebook_tracker: str | None = None googall_tracker: str | None = None @app.get("/items/") async def read_items(cookies: Cookies = Cookie()):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Sep 17 18:54:10 GMT 2024 - 303 bytes - Click Count (0) -
tests/test_sub_callbacks.py
from inline_snapshot import snapshot from pydantic import BaseModel, HttpUrl app = FastAPI() class Invoice(BaseModel): id: str title: str | None = None customer: str total: float class InvoiceEvent(BaseModel): description: str paid: bool class InvoiceEventReceived(BaseModel): ok: bool invoices_callback_router = APIRouter()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 14.3K bytes - Click Count (0) -
docs_src/response_model/tutorial001_01_py310.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None tags: list[str] = [] @app.post("/items/") async def create_item(item: Item) -> Item: return item @app.get("/items/") async def read_items() -> list[Item]: return [
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Jan 07 13:45:48 GMT 2023 - 469 bytes - Click Count (0) -
docs_src/body/tutorial003_py310.py
from fastapi import FastAPI from pydantic import BaseModel class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None app = FastAPI() @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 330 bytes - Click Count (0) -
docs_src/schema_extra_example/tutorial001_py310.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None model_config = { "json_schema_extra": { "examples": [ { "name": "Foo", "description": "A very nice Item", "price": 35.4,
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 646 bytes - Click Count (0) -
docs_src/path_operation_configuration/tutorial001_py310.py
from fastapi import FastAPI, status from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None tags: set[str] = set() @app.post("/items/", status_code=status.HTTP_201_CREATED) async def create_item(item: Item) -> Item:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 12:07:26 GMT 2026 - 350 bytes - Click Count (0) -
tests/test_request_params/test_form/test_optional_list.py
from typing import Annotated import pytest from fastapi import FastAPI, Form from fastapi.testclient import TestClient from pydantic import BaseModel, Field from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/optional-list-str", operation_id="optional_list_str") async def read_optional_list_str(
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 9.9K bytes - Click Count (0) -
docs_src/header_param_models/tutorial001_an_py310.py
from typing import Annotated from fastapi import FastAPI, Header from pydantic import BaseModel app = FastAPI() class CommonHeaders(BaseModel): host: str save_data: bool if_modified_since: str | None = None traceparent: str | None = None x_tag: list[str] = [] @app.get("/items/") async def read_items(headers: Annotated[CommonHeaders, Header()]):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Sep 17 18:54:10 GMT 2024 - 392 bytes - Click Count (0) -
docs_src/body_fields/tutorial001_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI from pydantic import BaseModel, Field app = FastAPI() class Item(BaseModel): name: str description: str | None = Field( default=None, title="The description of the item", max_length=300 ) price: float = Field(gt=0, description="The price must be greater than zero") tax: float | None = None @app.put("/items/{item_id}")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 563 bytes - Click Count (0)