Search Options

Results per page
Sort
Preferred Languages
Advance

Results 801 - 810 of 1,127 for def2 (0.03 sec)

  1. docs_src/cookie_param_models/tutorial001_py310.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Cookies(BaseModel):
        session_id: str
        fatebook_tracker: str | None = None
        googall_tracker: str | None = None
    
    
    @app.get("/items/")
    async def read_items(cookies: Cookies = Cookie()):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Sep 17 18:54:10 UTC 2024
    - 303 bytes
    - Viewed (0)
  2. docs_src/body/tutorial004_py310.py

    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, q: str | None = None):
        result = {"item_id": item_id, **item.dict()}
        if q:
            result.update({"q": q})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Jan 09 14:28:58 UTC 2024
    - 408 bytes
    - Viewed (0)
  3. docs_src/body_multiple_params/tutorial005_an_py310.py

    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: Annotated[Item, Body(embed=True)]):
        results = {"item_id": item_id, "item": item}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 409 bytes
    - Viewed (0)
  4. docs_src/body_nested_models/tutorial002.py

    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: List[str] = []
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 413 bytes
    - Viewed (0)
  5. docs_src/path_operation_configuration/tutorial001.py

        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.post("/items/", response_model=Item, status_code=status.HTTP_201_CREATED)
    async def create_item(item: Item):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 406 bytes
    - Viewed (0)
  6. docs_src/query_param_models/tutorial001_py39.py

        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()):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Sep 17 18:54:10 UTC 2024
    - 432 bytes
    - Viewed (0)
  7. docs_src/query_params_str_validations/tutorial006_an.py

    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str, Query(min_length=3)]):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 304 bytes
    - Viewed (0)
  8. docs_src/query_params_str_validations/tutorial014_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        hidden_query: Annotated[Union[str, None], Query(include_in_schema=False)] = None,
    ):
        if hidden_query:
            return {"hidden_query": hidden_query}
        else:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 344 bytes
    - Viewed (0)
  9. docs_src/query_params_str_validations/tutorial006c_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)] = ...):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 307 bytes
    - Viewed (0)
  10. docs_src/request_form_models/tutorial002_pv1_an.py

    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    class FormData(BaseModel):
        username: str
        password: str
    
        class Config:
            extra = "forbid"
    
    
    @app.post("/login/")
    async def login(data: Annotated[FormData, Form()]):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Sep 06 17:31:18 UTC 2024
    - 322 bytes
    - Viewed (0)
Back to top