Search Options

Results per page
Sort
Preferred Languages
Advance

Results 221 - 230 of 1,072 for Str (0.02 sec)

  1. docs_src/websockets/tutorial002_an_py310.py

        websocket: WebSocket,
        session: Annotated[str | None, Cookie()] = None,
        token: Annotated[str | None, Query()] = None,
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        *,
        websocket: WebSocket,
        item_id: str,
        q: int | None = 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_src/websockets/tutorial002_py310.py

        websocket: WebSocket,
        session: str | None = Cookie(default=None),
        token: str | None = Query(default=None),
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        websocket: WebSocket,
        item_id: str,
        q: int | None = None,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 2.7K bytes
    - Viewed (0)
  3. docs_src/query_params/tutorial005.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_user_item(item_id: str, needy: str):
        item = {"item_id": item_id, "needy": needy}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 192 bytes
    - Viewed (0)
  4. docs/uk/docs/tutorial/encoder.md

    ```
    
    ////
    
    У цьому прикладі вона конвертує Pydantic model у `dict`, а `datetime` у `str`.
    
    Результат виклику цієї функції - це щось, що можна кодувати з використанням стандарту Python <a href="https://docs.python.org/3/library/json.html#json.dumps" class="external-link" target="_blank">`json.dumps()`</a>.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  5. docs/nl/docs/python-types.md

    ```Python hl_lines="1  4"
    {!../../docs_src/python_types/tutorial009.py!}
    ```
    
    Door `Optional[str]` te gebruiken in plaats van alleen `str`, kan de editor je helpen fouten te detecteren waarbij je ervan uit zou kunnen gaan dat een waarde altijd een `str` is, terwijl het in werkelijkheid ook `None` zou kunnen zijn.
    
    `Optional[EenType]` is eigenlijk een snelkoppeling voor `Union[EenType, None]`, ze zijn equivalent.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 18.3K bytes
    - Viewed (0)
  6. docs_src/websockets/tutorial002_an.py

        session: Annotated[Union[str, None], Cookie()] = None,
        token: Annotated[Union[str, None], Query()] = None,
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        *,
        websocket: WebSocket,
        item_id: str,
        q: Union[int, None] = 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)
  7. docs_src/websockets/tutorial002_an_py39.py

        session: Annotated[Union[str, None], Cookie()] = None,
        token: Annotated[Union[str, None], Query()] = None,
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        *,
        websocket: WebSocket,
        item_id: str,
        q: Union[int, None] = 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)
  8. docs/es/docs/python-types.md

    Vamos a cambiar exactamente este fragmento, los parámetros de la función, de:
    
    ```Python
        first_name, last_name
    ```
    
    a:
    
    ```Python
        first_name: str, last_name: str
    ```
    
    Eso es todo.
    
    Esos son los "type hints":
    
    ```Python hl_lines="1"
    {!../../docs_src/python_types/tutorial002.py!}
    ```
    
    No es lo mismo a declarar valores por defecto, como sería con:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.1K bytes
    - Viewed (0)
  9. docs_src/websockets/tutorial002.py

        websocket: WebSocket,
        session: Union[str, None] = Cookie(default=None),
        token: Union[str, None] = Query(default=None),
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        websocket: WebSocket,
        item_id: str,
        q: Union[int, None] = None,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Nov 13 16:10:54 UTC 2022
    - 2.8K bytes
    - Viewed (0)
  10. docs_src/request_form_models/tutorial001_an.py

    from fastapi import FastAPI, Form
    from pydantic import BaseModel
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    class FormData(BaseModel):
        username: str
        password: str
    
    
    @app.post("/login/")
    async def login(data: Annotated[FormData, Form()]):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Sep 05 15:16:50 UTC 2024
    - 278 bytes
    - Viewed (0)
Back to top