- Sort Score
- Num 10 results
- Language All
Results 101 - 110 of 223 for BaseModel (0.8 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
tests/test_security_openid_connect.py
from fastapi.security.open_id_connect_url import OpenIdConnect from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() oid = OpenIdConnect(openIdConnectUrl="/openid") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(oid)): user = User(username=oauth_header) return user
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 2.5K bytes - Click Count (0) -
tests/test_security_openid_connect_description.py
from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() oid = OpenIdConnect( openIdConnectUrl="/openid", description="OpenIdConnect security scheme" ) class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(oid)): user = User(username=oauth_header) return user
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 2.6K bytes - Click Count (0) -
docs_src/header_param_models/tutorial002_py310.py
from fastapi import FastAPI, Header from pydantic import BaseModel app = FastAPI() class CommonHeaders(BaseModel): model_config = {"extra": "forbid"} 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: 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_multiple_params/tutorial005_py310.py
from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item = Body(embed=True)): results = {"item_id": item_id, "item": item}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 369 bytes - Click Count (0) -
docs_src/body_nested_models/tutorial002_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.put("/items/{item_id}") async def update_item(item_id: int, item: Item): results = {"item_id": item_id, "item": item}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 369 bytes - Click Count (0) -
docs_src/pydantic_v1_in_v2/tutorial004_an_py310.py
from typing import Annotated from fastapi import FastAPI from fastapi.temp_pydantic_v1_params import Body from pydantic.v1 import BaseModel class Item(BaseModel): name: str description: str | None = None size: float app = FastAPI() @app.post("/items/") async def create_item(item: Annotated[Item, Body(embed=True)]) -> Item:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Oct 11 16:45:54 GMT 2025 - 360 bytes - Click Count (0) -
docs_src/body_nested_models/tutorial003_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: set[str] = set() @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item): results = {"item_id": item_id, "item": item}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 371 bytes - Click Count (0) -
docs_src/header_param_models/tutorial002_an_py310.py
from typing import Annotated from fastapi import FastAPI, Header from pydantic import BaseModel app = FastAPI() class CommonHeaders(BaseModel): model_config = {"extra": "forbid"} 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 - 432 bytes - Click Count (0) -
docs_src/query_param_models/tutorial001_py310.py
from typing import 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: FilterParams = Query()):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Sep 17 18:54:10 GMT 2024 - 422 bytes - Click Count (0) -
docs_src/server_sent_events/tutorial005_py310.py
from collections.abc import AsyncIterable from fastapi import FastAPI from fastapi.sse import EventSourceResponse, ServerSentEvent from pydantic import BaseModel app = FastAPI() class Prompt(BaseModel): text: str @app.post("/chat/stream", response_class=EventSourceResponse) async def stream_chat(prompt: Prompt) -> AsyncIterable[ServerSentEvent]: words = prompt.text.split() for word in words:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 528 bytes - Click Count (0)