Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 111 - 120 of 445 for item_1 (0.27 seconds)

  1. docs_src/query_params_str_validations/tutorial004_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[
            str | None, Query(min_length=3, max_length=50, pattern="^fixedquery$")
        ] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 368 bytes
    - Click Count (0)
  2. docs_src/schema_extra_example/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(
            openapi_examples={
                "normal": {
                    "summary": "A normal example",
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Aug 26 18:03:13 GMT 2023
    - 1.3K bytes
    - Click Count (0)
  3. tests/test_tutorial/test_body_multiple_params/test_tutorial002.py

                "openapi": "3.1.0",
                "paths": {
                    "/items/{item_id}": {
                        "put": {
                            "operationId": "update_item_items__item_id__put",
                            "parameters": [
                                {
                                    "in": "path",
                                    "name": "item_id",
                                    "required": True,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 11.7K bytes
    - Click Count (0)
  4. docs/en/docs/index.md

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: bool | None = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
    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)
  5. docs_src/query_params_str_validations/tutorial010_py310.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: str | None = Query(
            default=None,
            alias="item-query",
            title="Query string",
            description="Query string for the items to search in the database that have a good match",
            min_length=3,
            max_length=50,
            pattern="^fixedquery$",
            deprecated=True,
        ),
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 542 bytes
    - Click Count (0)
  6. docs_src/app_testing/app_b_an_py310/main.py

        return fake_db[item_id]
    
    
    @app.post("/items/")
    async def create_item(item: Item, x_token: Annotated[str, Header()]) -> Item:
        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item.id in fake_db:
            raise HTTPException(status_code=409, detail="Item already exists")
        fake_db[item.id] = item.model_dump()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 13:32:24 GMT 2026
    - 1.1K bytes
    - Click Count (0)
  7. docs_src/additional_responses/tutorial004_py310.py

    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        id: str
        value: str
    
    
    responses = {
        404: {"description": "Item not found"},
        302: {"description": "The item was moved"},
        403: {"description": "Not enough privileges"},
    }
    
    
    app = FastAPI()
    
    
    @app.get(
        "/items/{item_id}",
        response_model=Item,
        responses={**responses, 200: {"content": {"image/png": {}}}},
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 10 08:55:32 GMT 2025
    - 669 bytes
    - Click Count (0)
  8. docs/ru/docs/tutorial/path-params.md

    {* ../../docs_src/path_params/tutorial001_py310.py hl[6:7] *}
    
    Значение параметра пути `item_id` будет передано в функцию в качестве аргумента `item_id`.
    
    Если запустите этот пример и перейдёте по адресу: [http://127.0.0.1:8000/items/foo](http://127.0.0.1:8000/items/foo), то увидите ответ:
    
    ```JSON
    {"item_id":"foo"}
    ```
    
    ## Параметры пути с типами { #path-parameters-with-types }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 14K bytes
    - Click Count (0)
  9. docs_src/additional_status_codes/tutorial001_py310.py

    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: str | None = Body(default=None),
        size: int | None = Body(default=None),
    ):
        if item_id in items:
            item = items[item_id]
            item["name"] = name
            item["size"] = size
            return item
        else:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 646 bytes
    - Click Count (0)
  10. docs/es/docs/tutorial/path-params.md

    {* ../../docs_src/path_params/tutorial001_py310.py hl[6:7] *}
    
    El valor del parámetro de path `item_id` se pasará a tu función como el argumento `item_id`.
    
    Así que, si ejecutas este ejemplo y vas a [http://127.0.0.1:8000/items/foo](http://127.0.0.1:8000/items/foo), verás un response de:
    
    ```JSON
    {"item_id":"foo"}
    ```
    
    ## Parámetros de path con tipos { #path-parameters-with-types }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 9.4K bytes
    - Click Count (0)
Back to Top