Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 147 for head_item (0.18 seconds)

  1. tests/test_extra_routes.py

    
    @app.delete("/items/{item_id}")
    def delete_item(item_id: str, item: Item):
        return {"item_id": item_id, "item": item}
    
    
    @app.head("/items/{item_id}")
    def head_item(item_id: str):
        return JSONResponse(None, headers={"x-fastapi-item-id": item_id})
    
    
    @app.options("/items/{item_id}")
    def options_item(item_id: str):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 14.7K bytes
    - Click Count (0)
  2. docs_src/bigger_applications/app_an_py310/routers/items.py

        responses={404: {"description": "Not found"}},
    )
    
    
    fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}}
    
    
    @router.get("/")
    async def read_items():
        return fake_items_db
    
    
    @router.get("/{item_id}")
    async def read_item(item_id: str):
        if item_id not in fake_items_db:
            raise HTTPException(status_code=404, detail="Item not found")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 1011 bytes
    - Click Count (0)
  3. fastapi/.agents/skills/fastapi/SKILL.md

    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(
        item_id: Annotated[int, Path(ge=1, description="The item ID")],
        q: Annotated[str | None, Query(max_length=50)] = None,
    ):
        return {"message": "Hello World"}
    ```
    
    instead of:
    
    ```python
    # DO NOT DO THIS
    @app.get("/items/{item_id}")
    async def read_item(
        item_id: int = Path(ge=1, description="The item ID"),
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 10:05:57 GMT 2026
    - 10.1K bytes
    - Click Count (0)
  4. tests/test_invalid_path_param.py

                title: str
    
            @app.get("/items/{id}")
            def read_items(id: list[Item]):
                pass  # pragma: no cover
    
    
    def test_invalid_tuple():
        with pytest.raises(AssertionError):
            app = FastAPI()
    
            class Item(BaseModel):
                title: str
    
            @app.get("/items/{id}")
            def read_items(id: tuple[Item, Item]):
                pass  # pragma: no cover
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 1.6K bytes
    - Click Count (0)
  5. docs/uk/docs/advanced/templates.md

    Тож фрагмент:
    
    {% raw %}
    
    ```jinja
    <a href="{{ url_for('read_item', id=id) }}">
    ```
    
    {% endraw %}
    
    ...згенерує посилання на той самий URL, який оброблятиме *функція операції шляху* `read_item(id=id)`.
    
    Наприклад, з ID `42` це буде відображено як:
    
    ```html
    <a href="/items/42">
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 4.9K bytes
    - Click Count (0)
  6. tests/test_invalid_sequence_param.py

            match="Query parameter 'q' must be one of the supported types",
        ):
            app = FastAPI()
    
            class Item(BaseModel):
                title: str
    
            @app.get("/items/")
            def read_items(q: list[Item] = Query(default=None)):
                pass  # pragma: no cover
    
    
    def test_invalid_tuple():
        with pytest.raises(
            AssertionError,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 1.5K bytes
    - Click Count (0)
  7. docs_src/path_params/tutorial002_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 143 bytes
    - Click Count (0)
  8. docs/es/docs/advanced/templates.md

    Entonces, la sección con:
    
    {% raw %}
    
    ```jinja
    <a href="{{ url_for('read_item', id=id) }}">
    ```
    
    {% endraw %}
    
    ...generará un enlace hacia la misma URL que manejaría la *path operation function* `read_item(id=id)`.
    
    Por ejemplo, con un ID de `42`, esto se renderizaría como:
    
    ```html
    <a href="/items/42">
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 3.6K bytes
    - Click Count (0)
  9. docs_src/query_params/tutorial001_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
    
    
    @app.get("/items/")
    async def read_item(skip: int = 0, limit: int = 10):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 250 bytes
    - Click Count (0)
  10. docs/en/docs/advanced/templates.md

    So, the section with:
    
    {% raw %}
    
    ```jinja
    <a href="{{ url_for('read_item', id=id) }}">
    ```
    
    {% endraw %}
    
    ...will generate a link to the same URL that would be handled by the *path operation function* `read_item(id=id)`.
    
    For example, with an ID of `42`, this would render:
    
    ```html
    <a href="/items/42">
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 3.4K bytes
    - Click Count (0)
Back to Top