Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 271 - 280 of 1,681 for tone (0.02 seconds)

  1. 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)
  2. docs_src/body/tutorial002_py310.py

    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    async def create_item(item: Item):
        item_dict = item.model_dump()
        if item.tax is not None:
            price_with_tax = item.price + item.tax
            item_dict.update({"price_with_tax": price_with_tax})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 447 bytes
    - Click Count (0)
  3. docs_src/header_param_models/tutorial002_an_py310.py

    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)
  4. docs_src/pydantic_v1_in_v2/tutorial003_an_py310.py

    from pydantic import BaseModel as BaseModelV2
    from pydantic.v1 import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        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)
  5. docs_src/request_files/tutorial001_02_py310.py

    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: bytes | None = File(default=None)):
        if not file:
            return {"message": "No file sent"}
        else:
            return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(file: UploadFile | None = None):
        if not file:
            return {"message": "No upload file sent"}
        else:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 470 bytes
    - Click Count (0)
  6. docs/uk/docs/virtual-environments.md

    ```mermaid
    flowchart LR
        subgraph global[global env]
            harry-1[harry v1]
        end
        subgraph stone-project[philosophers-stone project]
            stone(philosophers-stone) -->|requires| harry-1
        end
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 33.3K bytes
    - Click Count (0)
  7. docs/es/docs/tutorial/query-params-str-validations.md

    Teníamos esta anotación de tipo:
    
    ```Python
    q: str | None = None
    ```
    
    Lo que haremos es envolver eso con `Annotated`, para que se convierta en:
    
    ```Python
    q: Annotated[str | None] = None
    ```
    
    Ambas versiones significan lo mismo, `q` es un parámetro que puede ser un `str` o `None`, y por defecto, es `None`.
    
    Ahora vamos a lo divertido. 🎉
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 17.4K bytes
    - Click Count (0)
  8. docs_src/path_operation_configuration/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: set[str] = set()
    
    
    @app.post("/items/", tags=["items"])
    async def create_item(item: Item) -> Item:
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 12:07:26 GMT 2026
    - 524 bytes
    - Click Count (0)
  9. tests/test_tutorial/test_bigger_applications/test_main.py

                    "loc": ["query", "token"],
                    "msg": "Field required",
                    "input": None,
                },
                {
                    "type": "missing",
                    "loc": ["header", "x-token"],
                    "msg": "Field required",
                    "input": None,
                },
            ]
        }
    
    
    def test_put_invalid_header(client: TestClient):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 22.8K bytes
    - Click Count (0)
  10. tests/test_optional_file_list.py

    from fastapi import FastAPI, File
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.post("/files")
    async def upload_files(files: list[bytes] | None = File(None)):
        if files is None:
            return {"files_count": 0}
        return {"files_count": len(files), "sizes": [len(f) for f in files]}
    
    
    def test_optional_bytes_list():
        client = TestClient(app)
        response = client.post(
            "/files",
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 789 bytes
    - Click Count (0)
Back to Top