Search Options

Results per page
Sort
Preferred Languages
Advance

Results 891 - 900 of 1,127 for def2 (0.03 sec)

  1. docs_src/body_multiple_params/tutorial001_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: Annotated[int, Path(title="The ID of the item to get", ge=0, le=1000)],
        q: str | None = None,
        item: Item | None = None,
    ):
        results = {"item_id": item_id}
        if q:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 579 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_background_tasks/test_tutorial002_an.py

    import os
    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.background_tasks.tutorial002_an import app
    
    client = TestClient(app)
    
    
    def test():
        log = Path("log.txt")
        if log.is_file():
            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***?q=some-query")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 571 bytes
    - Viewed (0)
  3. fastapi/concurrency.py

    from starlette.concurrency import (  # noqa
        run_until_first_complete as run_until_first_complete,
    )
    
    _T = TypeVar("_T")
    
    
    @asynccontextmanager
    async def contextmanager_in_threadpool(
        cm: ContextManager[_T],
    ) -> AsyncGenerator[_T, None]:
        # blocking __exit__ from running waiting on a free thread
        # can create race conditions/deadlocks if the context manager itself
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Dec 25 17:57:35 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  4. docs_src/first_steps/tutorial003.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def root():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 111 bytes
    - Viewed (0)
  5. docs_src/path_operation_configuration/tutorial004_py39.py

        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, summary="Create an item")
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
        - **name**: each item must have a name
        - **description**: a long description
        - **price**: required
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 676 bytes
    - Viewed (0)
  6. docs_src/first_steps/tutorial002.py

    from fastapi import FastAPI
    
    my_awesome_api = FastAPI()
    
    
    @my_awesome_api.get("/")
    async def root():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 139 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_testing/test_tutorial003.py

    import pytest
    
    
    def test_main():
        with pytest.warns(DeprecationWarning):
            from docs_src.app_testing.tutorial003 import test_read_items
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 18 12:36:40 UTC 2023
    - 167 bytes
    - Viewed (0)
  8. docs_src/bigger_applications/app/internal/admin.py

    from fastapi import APIRouter
    
    router = APIRouter()
    
    
    @router.post("/")
    async def update_admin():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Nov 29 17:32:18 UTC 2020
    - 147 bytes
    - Viewed (0)
  9. docs_src/bigger_applications/app_an/internal/admin.py

    from fastapi import APIRouter
    
    router = APIRouter()
    
    
    @router.post("/")
    async def update_admin():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 147 bytes
    - Viewed (0)
  10. docs_src/path_operation_advanced_configuration/tutorial003.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/", include_in_schema=False)
    async def read_items():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 148 bytes
    - Viewed (0)
Back to top