Search Options

Results per page
Sort
Preferred Languages
Advance

Results 681 - 690 of 1,127 for def2 (0.04 sec)

  1. tests/test_tutorial/test_testing/test_main_b_an_py310.py

    from ...utils import needs_py310
    
    
    @needs_py310
    def test_app():
        from docs_src.app_testing.app_b_an_py310 import test_main
    
        test_main.test_create_existing_item()
        test_main.test_create_item()
        test_main.test_create_item_bad_token()
        test_main.test_read_nonexistent_item()
        test_main.test_read_item()
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Mar 13 19:07:10 UTC 2024
    - 360 bytes
    - Viewed (0)
  2. docs_src/templates/tutorial001.py

    app = FastAPI()
    
    app.mount("/static", StaticFiles(directory="static"), name="static")
    
    
    templates = Jinja2Templates(directory="templates")
    
    
    @app.get("/items/{id}", response_class=HTMLResponse)
    async def read_item(request: Request, id: str):
        return templates.TemplateResponse(
            request=request, name="item.html", context={"id": id}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Dec 26 20:12:34 UTC 2023
    - 521 bytes
    - Viewed (0)
  3. docs_src/body_multiple_params/tutorial002_py310.py

        description: str | None = None
        price: float
        tax: float | None = None
    
    
    class User(BaseModel):
        username: str
        full_name: str | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, user: User):
        results = {"item_id": item_id, "item": item, "user": user}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 446 bytes
    - Viewed (0)
  4. docs_src/query_params_str_validations/tutorial008.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Union[str, None] = Query(
            default=None,
            title="Query string",
            description="Query string for the items to search in the database that have a good match",
            min_length=3,
        ),
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 466 bytes
    - Viewed (0)
  5. docs_src/path_params_numeric_validations/tutorial006.py

    from fastapi import FastAPI, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        *,
        item_id: int = Path(title="The ID of the item to get", ge=0, le=1000),
        q: str,
        size: float = Query(gt=0, lt=10.5),
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
        if size:
            results.update({"size": size})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Aug 28 23:39:15 UTC 2024
    - 397 bytes
    - Viewed (0)
  6. docs_src/query_param_models/tutorial002.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
    - 497 bytes
    - Viewed (0)
  7. docs/ru/docs/tutorial/background-tasks.md

    Это совершенно обычная функция, которая может принимать параметры.
    
    Она может быть как асинхронной `async def`, так и обычной `def` функцией, **FastAPI** знает, как правильно ее выполнить.
    
    В нашем примере фоновая задача будет вести запись в файл (симулируя отправку письма).
    
    Так как операция записи не использует `async` и `await`, мы определим ее как обычную `def`:
    
    ```Python hl_lines="6-9"
    {!../../docs_src/background_tasks/tutorial001.py!}
    ```
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8K bytes
    - Viewed (0)
  8. docs_src/custom_response/tutorial006c.py

    from fastapi import FastAPI
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/pydantic", response_class=RedirectResponse, status_code=302)
    async def redirect_pydantic():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Mar 22 01:42:11 UTC 2024
    - 237 bytes
    - Viewed (0)
  9. docs_src/query_params_str_validations/tutorial013_an.py

    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[list, Query()] = []):
        query_items = {"q": q}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 220 bytes
    - Viewed (0)
  10. docs_src/cookie_params/tutorial001.py

    from typing import Union
    
    from fastapi import Cookie, FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(ads_id: Union[str, None] = Cookie(default=None)):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 202 bytes
    - Viewed (0)
Back to top