Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 541 - 550 of 795 for asyncId (0.06 seconds)

  1. docs_src/handling_errors/tutorial002_py310.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"},
            )
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 404 bytes
    - Click Count (0)
  2. docs_src/pydantic_v1_in_v2/tutorial004_an_py310.py

    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)
  3. docs_src/header_param_models/tutorial002_an_py310.py

        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)
  4. docs_src/query_params/tutorial003_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: str, q: str | None = None, short: bool = False):
        item = {"item_id": item_id}
        if q:
            item.update({"q": q})
        if not short:
            item.update(
                {"description": "This is an amazing item that has a long description"}
            )
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 374 bytes
    - Click Count (0)
  5. docs/en/docs/index.md

    ```
    
    <details markdown="1">
    <summary>Or use <code>async def</code>...</summary>
    
    If your code uses `async` / `await`, use `async def`:
    
    ```Python hl_lines="7  12"
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    async def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int, q: str | None = None):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 07 09:29:03 GMT 2026
    - 21.4K bytes
    - Click Count (0)
  6. docs_src/path_params_numeric_validations/tutorial001_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        item_id: Annotated[int, Path(title="The ID of the item to get")],
        q: Annotated[str | None, Query(alias="item-query")] = None,
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 375 bytes
    - Click Count (0)
  7. docs_src/pydantic_v1_in_v2/tutorial003_an_py310.py

        size: float
    
    
    class ItemV2(BaseModelV2):
        name: str
        description: str | None = None
        size: float
    
    
    app = FastAPI()
    
    
    @app.post("/items/", response_model=ItemV2)
    async def create_item(item: Item):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Oct 11 16:45:54 GMT 2025
    - 407 bytes
    - Click Count (0)
  8. docs_src/query_param_models/tutorial001_py310.py

    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)
  9. 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)
  10. guava-gwt/src-super/com/google/common/escape/super/com/google/common/escape/Platform.java

        // ThreadLocal is not available to GWT, so we always reuse the same
        // instance.  It is always safe to return the same instance because
        // javascript is single-threaded, and only used by blocks that doesn't
        // involve async callbacks.
        return CHAR_BUFFER;
      }
    
      private Platform() {}
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Sat Jan 18 02:54:30 GMT 2025
    - 1.1K bytes
    - Click Count (0)
Back to Top