Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 124 for Krause (0.15 sec)

  1. docs_src/security/tutorial007_an.py

        correct_password_bytes = b"swordfish"
        is_correct_password = secrets.compare_digest(
            current_password_bytes, correct_password_bytes
        )
        if not (is_correct_username and is_correct_password):
            raise HTTPException(
                status_code=status.HTTP_401_UNAUTHORIZED,
                detail="Incorrect username or password",
                headers={"WWW-Authenticate": "Basic"},
            )
        return credentials.username
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_dependencies/test_tutorial008d_an.py

            exc_info.value.args[0] == "The portal gun is too dangerous to be owned by Rick"
        )
    
    
    def test_internal_server_error():
        from docs_src.dependencies.tutorial008d_an import app
    
        client = TestClient(app, raise_server_exceptions=False)
        response = client.get("/items/portal-gun")
        assert response.status_code == 500, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  3. docs/ja/docs/tutorial/handling-errors.md

    あなた(または使用しているライブラリ)が`raise`するかもしれないカスタム例外`UnicornException`があるとしましょう。
    
    そして、この例外をFastAPIでグローバルに処理したいと思います。
    
    カスタム例外ハンドラを`@app.exception_handler()`で追加することができます:
    
    ```Python hl_lines="5 6 7  13 14 15 16 17 18  24"
    {!../../../docs_src/handling_errors/tutorial003.py!}
    ```
    
    ここで、`/unicorns/yolo`をリクエストすると、*path operation*は`UnicornException`を`raise`します。
    
    しかし、これは`unicorn_exception_handler`で処理されます。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  4. docs_src/websockets/tutorial002_an_py310.py

    
    async def get_cookie_or_token(
        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,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  5. fastapi/security/oauth2.py

        async def __call__(self, request: Request) -> Optional[str]:
            authorization = request.headers.get("Authorization")
            if not authorization:
                if self.auto_error:
                    raise HTTPException(
                        status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"
                    )
                else:
                    return None
            return authorization
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  6. docs/zh/docs/tutorial/handling-errors.md

    ```
    
    ### 触发 `HTTPException`
    
    `HTTPException` 是额外包含了和 API 有关数据的常规 Python 异常。
    
    因为是 Python 异常,所以不能 `return`,只能 `raise`。
    
    如在调用*路径操作函数*里的工具函数时,触发了 `HTTPException`,FastAPI 就不再继续执行*路径操作函数*中的后续代码,而是立即终止请求,并把 `HTTPException` 的 HTTP 错误发送至客户端。
    
    在介绍依赖项与安全的章节中,您可以了解更多用 `raise` 异常代替 `return` 值的优势。
    
    本例中,客户端用 `ID` 请求的 `item` 不存在时,触发状态码为 `404` 的异常:
    
    ```Python hl_lines="11"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  7. docs/em/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md

    👆 💪 ⚙️ 🎏 🔗 *🔢* 👆 ⚙️ 🛎.
    
    ### 🔗 📄
    
    👫 💪 📣 📨 📄 (💖 🎚) ⚖️ 🎏 🎧-🔗:
    
    ```Python hl_lines="6  11"
    {!../../../docs_src/dependencies/tutorial006.py!}
    ```
    
    ### 🤚 ⚠
    
    👫 🔗 💪 `raise` ⚠, 🎏 😐 🔗:
    
    ```Python hl_lines="8  13"
    {!../../../docs_src/dependencies/tutorial006.py!}
    ```
    
    ### 📨 💲
    
    & 👫 💪 📨 💲 ⚖️ 🚫, 💲 🏆 🚫 ⚙️.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  8. docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md

        !!! tip "팁"
            가능하다면 `Annotated`가 달린 버전을 권장합니다.
    
        ```Python hl_lines="6  11"
        {!> ../../../docs_src/dependencies/tutorial006.py!}
        ```
    
    ### 오류 발생시키기
    
    다음 의존성은 기존 의존성과 동일하게 예외를 `raise`를 일으킬 수 있습니다:
    
    === "Python 3.9+"
    
        ```Python hl_lines="10  15"
        {!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="9  14"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Feb 11 13:49:45 GMT 2024
    - 4.7K bytes
    - Viewed (0)
  9. fastapi/utils.py

                    "alias": alias,
                }
            )
        try:
            return ModelField(**kwargs)  # type: ignore[arg-type]
        except (RuntimeError, PydanticSchemaGenerationError):
            raise fastapi.exceptions.FastAPIError(
                "Invalid args for response field! Hint: "
                f"check that {type_} is a valid Pydantic field type. "
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  10. docs/em/docs/advanced/security/oauth2-scopes.md

    `security_scopes` 🎚 (🎓 `SecurityScopes`) 🚚 `scope_str` 🔢 ⏮️ 👁 🎻, 🔌 👈 ↔ 👽 🚀 (👥 🔜 ⚙️ ⚫️).
    
    👥 ✍ `HTTPException` 👈 👥 💪 🏤-⚙️ (`raise`) ⏪ 📚 ☝.
    
    👉 ⚠, 👥 🔌 ↔ 🚚 (🚥 🙆) 🎻 👽 🚀 (⚙️ `scope_str`). 👥 🚮 👈 🎻 ⚗ ↔ `WWW-Authenticate` 🎚 (👉 🍕 🔌).
    
    ```Python hl_lines="105  107-115"
    {!../../../docs_src/security/tutorial005.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 21:21:35 GMT 2024
    - 11.1K bytes
    - Viewed (0)
Back to top