Search Options

Results per page
Sort
Preferred Languages
Advance

Results 161 - 170 of 1,174 for async (0.05 sec)

  1. docs_src/websockets/tutorial002_an_py39.py

                    input.value = ''
                    event.preventDefault()
                }
            </script>
        </body>
    </html>
    """
    
    
    @app.get("/")
    async def get():
        return HTMLResponse(html)
    
    
    async def get_cookie_or_token(
        websocket: WebSocket,
        session: Annotated[Union[str, None], Cookie()] = None,
        token: Annotated[Union[str, None], Query()] = None,
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 2.8K bytes
    - Viewed (0)
  2. docs/em/docs/advanced/dataclasses.md

        ๐Ÿ”„, ๐Ÿ‘† ๐Ÿ’ช ๐ŸŒ€ `dataclasses` โฎ๏ธ ๐Ÿฉ ๐Ÿ†Ž โœ.
    
    8๏ธโƒฃ. ๐Ÿ‘€ ๐Ÿ‘ˆ ๐Ÿ‘‰ *โžก ๐Ÿ› ๏ธ ๐Ÿ”ข* โš™๏ธ ๐Ÿฅ” `def` โ†ฉ๏ธ `async def`.
    
        ๐Ÿ•ง, FastAPI ๐Ÿ‘† ๐Ÿ’ช ๐ŸŒ€ `def` &amp; `async def` ๐Ÿ’ช.
    
        ๐Ÿšฅ ๐Ÿ‘† ๐Ÿ’ช โ†—๏ธ ๐Ÿ”ƒ ๐Ÿ•โ” โš™๏ธ โ”, โœ… ๐Ÿ‘… ๐Ÿ“„ _"๐Ÿƒ โ“" _ ๐Ÿฉบ ๐Ÿ”ƒ <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank" class="internal-link">`async` &amp; `await`</a>.
    
    9๏ธโƒฃ. ๐Ÿ‘‰ *โžก ๐Ÿ› ๏ธ ๐Ÿ”ข* ๐Ÿšซ ๐Ÿ›ฌ ๐ŸŽป (๐Ÿ‘ โšซ๏ธ ๐Ÿ’ช), โœ‹๏ธ ๐Ÿ“‡ ๐Ÿ“– โฎ๏ธ ๐Ÿ”— ๐Ÿ’ฝ.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  3. docs_src/body_updates/tutorial001_py310.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    @app.put("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        update_item_encoded = jsonable_encoder(item)
        items[item_id] = update_item_encoded
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 856 bytes
    - Viewed (0)
  4. docs_src/response_model/tutorial001_01_py39.py

        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: list[str] = []
    
    
    @app.post("/items/")
    async def create_item(item: Item) -> Item:
        return item
    
    
    @app.get("/items/")
    async def read_items() -> list[Item]:
        return [
            Item(name="Portal Gun", price=42.0),
            Item(name="Plumbus", price=32.0),
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 507 bytes
    - Viewed (0)
  5. docs_src/handling_errors/tutorial005.py

    @app.exception_handler(RequestValidationError)
    async def validation_exception_handler(request: Request, exc: RequestValidationError):
        return JSONResponse(
            status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
            content=jsonable_encoder({"detail": exc.errors(), "body": exc.body}),
        )
    
    
    class Item(BaseModel):
        title: str
        size: int
    
    
    @app.post("/items/")
    async def create_item(item: Item):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 667 bytes
    - Viewed (0)
  6. docs_src/handling_errors/tutorial003.py

    
    app = FastAPI()
    
    
    @app.exception_handler(UnicornException)
    async def unicorn_exception_handler(request: Request, exc: UnicornException):
        return JSONResponse(
            status_code=418,
            content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."},
        )
    
    
    @app.get("/unicorns/{name}")
    async def read_unicorn(name: str):
        if name == "yolo":
            raise UnicornException(name=name)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 626 bytes
    - Viewed (0)
  7. docs/ja/docs/tutorial/dependencies/index.md

    ///
    
    ## `async`ใซใ™ใ‚‹ใ‹ใฉใ†ใ‹
    
    ไพๅญ˜้–ขไฟ‚ใฏ **FastAPI**๏ผˆ*path operation้–ขๆ•ฐ*ใจๅŒใ˜๏ผ‰ใ‹ใ‚‰ใ‚‚ๅ‘ผใณๅ‡บใ•ใ‚Œใ‚‹ใŸใ‚ใ€้–ขๆ•ฐใ‚’ๅฎš็พฉใ™ใ‚‹้š›ใซใ‚‚ๅŒใ˜ใƒซใƒผใƒซใŒ้ฉ็”จใ•ใ‚Œใพใ™ใ€‚
    
    `async def`ใ‚„้€šๅธธใฎ`def`ใ‚’ไฝฟ็”จใ™ใ‚‹ใ“ใจใŒใงใใพใ™ใ€‚
    
    ใพใŸใ€้€šๅธธใฎ`def`*path operation้–ขๆ•ฐ*ใฎไธญใซ`async def`ใ‚’ๅ…ฅใ‚Œใฆไพๅญ˜้–ขไฟ‚ใ‚’ๅฎฃ่จ€ใ—ใŸใ‚Šใ€`async def`*path operation้–ขๆ•ฐ*ใฎไธญใซ`def`ใ‚’ๅ…ฅใ‚Œใฆไพๅญ˜้–ขไฟ‚ใ‚’ๅฎฃ่จ€ใ—ใŸใ‚Šใ™ใ‚‹ใ“ใจใชใฉใŒใงใใพใ™ใ€‚
    
    ใใ‚Œใฏ้‡่ฆใงใฏใ‚ใ‚Šใพใ›ใ‚“ใ€‚**FastAPI** ใฏไฝ•ใ‚’ใ™ในใใ‹ใ‚’็Ÿฅใฃใฆใ„ใพใ™ใ€‚
    
    /// note | "ๅ‚™่€ƒ"
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.7K bytes
    - Viewed (0)
  8. tests/test_response_class_no_mediatype.py

    
    @app.get(
        "/a",
        response_class=Response,
        responses={500: {"description": "Error", "model": JsonApiError}},
    )
    async def a():
        pass  # pragma: no cover
    
    
    @app.get("/b", responses={500: {"description": "Error", "model": Error}})
    async def b():
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.3K bytes
    - Viewed (0)
  9. fastapi/security/api_key.py

        ```python
        from fastapi import Depends, FastAPI
        from fastapi.security import APIKeyQuery
    
        app = FastAPI()
    
        query_scheme = APIKeyQuery(name="api_key")
    
    
        @app.get("/items/")
        async def read_items(api_key: str = Depends(query_scheme)):
            return {"api_key": api_key}
        ```
        """
    
        def __init__(
            self,
            *,
            name: Annotated[
                str,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Apr 23 22:29:18 UTC 2024
    - 9.1K bytes
    - Viewed (0)
  10. tests/test_route_scope.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/users/{user_id}")
    async def get_user(user_id: str, request: Request):
        route: APIRoute = request.scope["route"]
        return {"user_id": user_id, "path": route.path}
    
    
    @app.websocket("/items/{item_id}")
    async def websocket_item(item_id: str, websocket: WebSocket):
        route: APIWebSocketRoute = websocket.scope["route"]
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Feb 08 10:23:07 UTC 2023
    - 1.5K bytes
    - Viewed (0)
Back to top