- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 10 for WebSocketException (0.16 sec)
-
docs/en/docs/reference/exceptions.md
# Exceptions - `HTTPException` and `WebSocketException` These are the exceptions that you can raise to show errors to the client. When you raise an exception, as would happen with normal Python, the rest of the execution is aborted. This way you can raise these exceptions from anywhere in the code to abort a request and show the error to the client. You can use: * `HTTPException` * `WebSocketException`
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:53:19 UTC 2024 - 597 bytes - Viewed (0) -
fastapi/exceptions.py
FastAPI, WebSocket, WebSocketException, status, ) app = FastAPI() @app.websocket("/items/{item_id}/ws") async def websocket_endpoint( *, websocket: WebSocket, session: Annotated[str | None, Cookie()] = None, item_id: str, ): if session is None: raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Apr 02 02:48:51 UTC 2024 - 4.9K bytes - Viewed (0) -
fastapi/__init__.py
from .background import BackgroundTasks as BackgroundTasks from .datastructures import UploadFile as UploadFile from .exceptions import HTTPException as HTTPException from .exceptions import WebSocketException as WebSocketException from .param_functions import Body as Body from .param_functions import Cookie as Cookie from .param_functions import Depends as Depends from .param_functions import File as File
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 27 21:51:55 UTC 2024 - 1.1K bytes - Viewed (0) -
docs/em/docs/advanced/websockets.md
* `Query` 👫 👷 🎏 🌌 🎏 FastAPI 🔗/*➡ 🛠️*: ```Python hl_lines="66-77 76-91" {!../../docs_src/websockets/tutorial002.py!} ``` /// info 👉 *️⃣ ⚫️ 🚫 🤙 ⚒ 🔑 🤚 `HTTPException`, ↩️ 👥 🤚 `WebSocketException`. 👆 💪 ⚙️ 📪 📟 ⚪️➡️ <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">☑ 📟 🔬 🔧</a>. /// ### 🔄 *️⃣ ⏮️ 🔗 🚥 👆 📁 📛 `main.py`, 🏃 👆 🈸 ⏮️:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 4.8K bytes - Viewed (0) -
docs/pt/docs/advanced/websockets.md
{*../../docs_src/websockets/tutorial002_an_py310.py hl[68:69,82]*} /// info | Informação Como isso é um WebSocket, não faz muito sentido levantar uma `HTTPException`, em vez disso levantamos uma `WebSocketException`. Você pode usar um código de fechamento dos <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">códigos válidos definidos na especificação</a>. ///
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Oct 31 12:20:59 UTC 2024 - 5.7K bytes - Viewed (0) -
docs/de/docs/advanced/websockets.md
{!> ../../docs_src/websockets/tutorial002.py!} ``` //// /// info Da es sich um einen WebSocket handelt, macht es keinen Sinn, eine `HTTPException` auszulösen, stattdessen lösen wir eine `WebSocketException` aus. Sie können einen „Closing“-Code verwenden, aus den <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">gültigen Codes, die in der Spezifikation definiert sind</a>.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6.9K bytes - Viewed (0) -
docs/zh/docs/advanced/websockets.md
如果可能,请尽量使用 `Annotated` 版本。 /// ```Python hl_lines="68-69 81" {!> ../../docs_src/websockets/tutorial002.py!} ``` //// /// info 由于这是一个 WebSocket,抛出 `HTTPException` 并不是很合理,而是抛出 `WebSocketException`。 您可以使用<a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">规范中定义的有效代码</a>。 /// ### 尝试带有依赖项的 WebSockets 如果您的文件名为 `main.py`,请使用以下命令运行应用程序:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.9K bytes - Viewed (0) -
docs/en/docs/advanced/websockets.md
```Python hl_lines="68-69 81" {!> ../../docs_src/websockets/tutorial002.py!} ``` //// /// info As this is a WebSocket it doesn't really make sense to raise an `HTTPException`, instead we raise a `WebSocketException`. You can use a closing code from the <a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">valid codes defined in the specification</a>. ///
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6.3K bytes - Viewed (0) -
docs/ja/docs/advanced/websockets.md
クロージングコードは、<a href="https://tools.ietf.org/html/rfc6455#section-7.4.1" class="external-link" target="_blank">仕様で定義された有効なコード</a>の中から使用することができます。 将来的には、どこからでも `raise` できる `WebSocketException` が用意され、専用の例外ハンドラを追加できるようになる予定です。これは、Starlette の <a href="https://github.com/encode/starlette/pull/527" class="external-link" target="_blank">PR #527</a> に依存するものです。 /// ### 依存関係を用いてWebSocketsを試してみる
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 7.2K bytes - Viewed (0) -
docs/en/docs/release-notes.md
* New [WebSocketException (and docs)](https://fastapi.tiangolo.com/advanced/websockets/#using-depends-and-others), re-exported from Starlette.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Nov 01 11:25:57 UTC 2024 - 460.3K bytes - Viewed (0)