Search Options

Results per page
Sort
Preferred Languages
Advance

Results 111 - 119 of 119 for HTTPException (0.08 sec)

  1. docs/de/docs/tutorial/security/simple-oauth2.md

    Wenn es keinen solchen Benutzer gibt, geben wir die Fehlermeldung „Incorrect username or password“ zurück.
    
    Für den Fehler verwenden wir die Exception `HTTPException`:
    
    //// tab | Python 3.10+
    
    ```Python hl_lines="3  79-81"
    {!> ../../docs_src/security/tutorial003_an_py310.py!}
    ```
    
    ////
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="3  79-81"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/security/simple-oauth2.md

    本例没有使用 `scopes`,但开发者也可以根据需要使用该属性。
    
    ///
    
    现在,即可使用表单字段 `username`,从(伪)数据库中获取用户数据。
    
    如果不存在指定用户,则返回错误消息,提示**用户名或密码错误**。
    
    本例使用 `HTTPException` 异常显示此错误:
    
    ```Python hl_lines="3  77-79"
    {!../../docs_src/security/tutorial003.py!}
    ```
    
    ### 校验密码
    
    至此,我们已经从数据库中获取了用户数据,但尚未校验密码。
    
    接下来,首先将数据放入 Pydantic 的 `UserInDB` 模型。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8.8K bytes
    - Viewed (0)
  3. docs/em/docs/tutorial/sql-databases.md

     & ⤴️ 👥 🔐 ⚫️ `finally` 🍫.
    
    👉 🌌 👥 ⚒ 💭 💽 🎉 🕧 📪 ⏮️ 📨. 🚥 📤 ⚠ ⏪ 🏭 📨.
    
    ✋️ 👆 💪 🚫 🤚 ➕1️⃣ ⚠ ⚪️➡️ 🚪 📟 (⏮️ `yield`). 👀 🌖 [🔗 ⏮️ `yield` & `HTTPException`](dependencies/dependencies-with-yield.md#yield-httpexception){.internal-link target=_blank}
    
    ///
    
    & ⤴️, 🕐❔ ⚙️ 🔗 *➡ 🛠️ 🔢*, 👥 📣 ⚫️ ⏮️ 🆎 `Session` 👥 🗄 🔗 ⚪️➡️ 🇸🇲.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 25K bytes
    - Viewed (0)
  4. docs/pt/docs/tutorial/security/simple-oauth2.md

    Se não existir tal usuário, retornaremos um erro dizendo "Incorrect username or password" (Nome de usuário ou senha incorretos).
    
    Para o erro, usamos a exceção `HTTPException`:
    
    //// tab | Python 3.10+
    
    ```Python hl_lines="3  79-81"
    {!> ../../docs_src/security/tutorial003_an_py310.py!}
    ```
    
    ////
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="3  79-81"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Oct 31 12:17:45 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  5. docs/ko/docs/tutorial/security/simple-oauth2.md

    이 예제에서는 `scopes`를 사용하지 않지만 필요한 경우, 기능이 있습니다.
    
    ///
    
    이제 폼 필드의 `username`을 사용하여 (가짜) 데이터베이스에서 유저 데이터를 가져옵니다.
    
    해당 사용자가 없으면 "잘못된 사용자 이름 또는 패스워드"라는 오류가 반환됩니다.
    
    오류의 경우 `HTTPException` 예외를 사용합니다:
    
    //// tab | 파이썬 3.7 이상
    
    ```Python hl_lines="3  77-79"
    {!> ../../docs_src/security/tutorial003.py!}
    ```
    
    ////
    
    //// tab | 파이썬 3.10 이상
    
    ```Python hl_lines="1  75-77"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.5K bytes
    - Viewed (0)
  6. fastapi/routing.py

                        body=e.doc,
                    )
                    raise validation_error from e
                except HTTPException:
                    # If a middleware raises an HTTPException, it should be raised again
                    raise
                except Exception as e:
                    http_error = HTTPException(
                        status_code=400, detail="There was an error parsing the body"
                    )
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Oct 12 09:44:57 UTC 2024
    - 172.1K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/sql-databases.md

    我们将`SessionLocal()`请求的创建和处理放在一个`try`块中。
    
    然后我们在finally块中关闭它。
    
    通过这种方式,我们确保数据库会话在请求后始终关闭。即使在处理请求时出现异常。
    
    但是您不能从退出代码中引发另一个异常(在yield之后)。可以查阅 [Dependencies with yield and HTTPException](https://fastapi.tiangolo.com/zh/tutorial/dependencies/dependencies-with-yield/#dependencies-with-yield-and-httpexception)
    
    ///
    
    *然后,当在路径操作函数*中使用依赖项时,我们使用`Session`,直接从 SQLAlchemy 导入的类型声明它。
    
    *这将为我们在路径操作函数*中提供更好的编辑器支持,因为编辑器将知道`db`参数的类型`Session`:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 27.1K bytes
    - Viewed (0)
  8. docs/en/docs/release-notes.md

    ### Dependencies with `yield`, `HTTPException` and Background Tasks
    
    Dependencies with `yield` now can raise `HTTPException` and other exceptions after `yield`. 🎉
    
    Read the new docs here: [Dependencies with `yield` and `HTTPException`](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield/#dependencies-with-yield-and-httpexception).
    
    ```Python
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Nov 01 11:25:57 UTC 2024
    - 460.3K bytes
    - Viewed (0)
  9. fastapi/applications.py

    from fastapi.types import DecoratedCallable, IncEx
    from fastapi.utils import generate_unique_id
    from starlette.applications import Starlette
    from starlette.datastructures import State
    from starlette.exceptions import HTTPException
    from starlette.middleware import Middleware
    from starlette.middleware.base import BaseHTTPMiddleware
    from starlette.requests import Request
    from starlette.responses import HTMLResponse, JSONResponse, Response
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:52:31 UTC 2024
    - 172.2K bytes
    - Viewed (0)
Back to top