- Sort Score
- Num 10 results
- Language All
Results 141 - 150 of 198 for ABC (0.04 seconds)
-
fastapi/.agents/skills/fastapi/references/streaming.md
Plain objects are automatically JSON-serialized as `data:` fields, declare the return type so the serialization is done by Pydantic: ```python from collections.abc import AsyncIterable from fastapi import FastAPI from fastapi.sse import EventSourceResponse from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str price: float
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 10:05:57 GMT 2026 - 2.5K bytes - Click Count (0) -
fastapi/concurrency.py
from collections.abc import AsyncGenerator from contextlib import AbstractContextManager from contextlib import asynccontextmanager as asynccontextmanager from typing import TypeVar import anyio.to_thread from anyio import CapacityLimiter from starlette.concurrency import iterate_in_threadpool as iterate_in_threadpool # noqa from starlette.concurrency import run_in_threadpool as run_in_threadpool # noqa from starlette.concurrency import ( # noqa
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 1.5K bytes - Click Count (0) -
docs_src/server_sent_events/tutorial003_py310.py
from collections.abc import AsyncIterable from fastapi import FastAPI from fastapi.sse import EventSourceResponse, ServerSentEvent app = FastAPI() @app.get("/logs/stream", response_class=EventSourceResponse) async def stream_logs() -> AsyncIterable[ServerSentEvent]: logs = [ "2025-01-01 INFO Application started", "2025-01-01 DEBUG Connected to database", "2025-01-01 WARN High memory usage detected", ]
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 518 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) -
docs_src/server_sent_events/tutorial002_py310.py
from collections.abc import AsyncIterable from fastapi import FastAPI from fastapi.sse import EventSourceResponse, ServerSentEvent from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str price: float items = [ Item(name="Plumbus", price=32.99), Item(name="Portal Gun", price=999.99), Item(name="Meeseeks Box", price=49.99), ]
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 686 bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial001_py310.py
import gzip from collections.abc import Callable from fastapi import Body, FastAPI, Request, Response from fastapi.routing import APIRoute class GzipRequest(Request): async def body(self) -> bytes: if not hasattr(self, "_body"): body = await super().body() if "gzip" in self.headers.getlist("Content-Encoding"): body = gzip.decompress(body) self._body = body
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 976 bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial001_an_py310.py
import gzip from collections.abc import Callable from typing import Annotated from fastapi import Body, FastAPI, Request, Response from fastapi.routing import APIRoute class GzipRequest(Request): async def body(self) -> bytes: if not hasattr(self, "_body"): body = await super().body() if "gzip" in self.headers.getlist("Content-Encoding"): body = gzip.decompress(body)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 1015 bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial002_py310.py
from collections.abc import Callable from fastapi import Body, FastAPI, HTTPException, Request, Response from fastapi.exceptions import RequestValidationError 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:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 935 bytes - Click Count (0) -
docs_src/stream_json_lines/tutorial001_py310.py
from collections.abc import AsyncIterable, Iterable from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None items = [ Item(name="Plumbus", description="A multi-purpose household device."), Item(name="Portal Gun", description="A portal opening device."), Item(name="Meeseeks Box", description="A box that summons a Meeseeks."), ]
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 18:56:47 GMT 2026 - 936 bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial003_py310.py
import time from collections.abc import Callable from fastapi import APIRouter, FastAPI, Request, Response from fastapi.routing import APIRoute class TimedRoute(APIRoute): def get_route_handler(self) -> Callable: original_route_handler = super().get_route_handler() async def custom_route_handler(request: Request) -> Response: before = time.time()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 1K bytes - Click Count (0)