Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 24 for raw_data (0.05 seconds)

  1. tests/test_sse.py

            yield item
    
    
    @app.get("/items/stream-raw", response_class=EventSourceResponse)
    async def sse_items_raw():
        yield ServerSentEvent(raw_data="plain text without quotes")
        yield ServerSentEvent(raw_data="<div>html fragment</div>", event="html")
        yield ServerSentEvent(raw_data="cpu,87.3,1709145600", event="csv")
    
    
    router = APIRouter()
    
    
    @router.get("/events", response_class=EventSourceResponse)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 9.8K bytes
    - Click Count (0)
  2. fastapi/sse.py

        def _check_data_exclusive(self) -> "ServerSentEvent":
            if self.data is not None and self.raw_data is not None:
                raise ValueError(
                    "Cannot set both 'data' and 'raw_data' on the same "
                    "ServerSentEvent. Use 'data' for JSON-serialized payloads "
                    "or 'raw_data' for pre-formatted strings."
                )
            return self
    
    
    def format_sse_event(
        *,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 6.2K bytes
    - Click Count (0)
  3. okhttp-hpacktests/src/test/java/okhttp3/internal/http2/HpackRoundTripTest.kt

     */
    class HpackRoundTripTest : HpackDecodeTestBase() {
      internal class StoriesTestProvider : SimpleProvider() {
        override fun arguments(): List<Any> = createStories(RAW_DATA)
      }
    
      private val bytesOut = Buffer()
      private val hpackWriter = Hpack.Writer(out = bytesOut)
    
      @ParameterizedTest
      @ArgumentsSource(StoriesTestProvider::class)
      fun testRoundTrip(story: Story) {
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2K bytes
    - Click Count (0)
  4. fastapi/.agents/skills/fastapi/references/streaming.md

        yield ServerSentEvent(data={"status": "started"}, event="status", id="1")
        yield ServerSentEvent(data={"progress": 50}, event="progress", id="2")
    ```
    
    Use `raw_data` instead of `data` to send pre-formatted strings without JSON encoding:
    
    ```python
    yield ServerSentEvent(raw_data="plain text line", event="log")
    ```
    
    ## Stream bytes
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 10:05:57 GMT 2026
    - 2.5K bytes
    - Click Count (0)
  5. docs/en/docs/tutorial/server-sent-events.md

    If you need to send data **without** JSON encoding, use `raw_data` instead of `data`.
    
    This is useful for sending pre-formatted text, log lines, or special <dfn title="A value used to indicate a special condition or state">"sentinel"</dfn> values like `[DONE]`.
    
    {* ../../docs_src/server_sent_events/tutorial003_py310.py hl[17] *}
    
    /// note
    
    `data` and `raw_data` are mutually exclusive. You can only set one of them on each `ServerSentEvent`.
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  6. docs_src/server_sent_events/tutorial003_py310.py

            "2025-01-01 INFO  Application started",
            "2025-01-01 DEBUG Connected to database",
            "2025-01-01 WARN  High memory usage detected",
        ]
        for log_line in logs:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 518 bytes
    - Click Count (0)
  7. docs_src/server_sent_events/tutorial005_py310.py

    async def stream_chat(prompt: Prompt) -> AsyncIterable[ServerSentEvent]:
        words = prompt.text.split()
        for word in words:
            yield ServerSentEvent(data=word, event="token")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 528 bytes
    - Click Count (0)
  8. docs/zh-hant/docs/tutorial/server-sent-events.md

    `data` 欄位一律會以 JSON 編碼。你可以傳入任何可序列化為 JSON 的值,包括 Pydantic 模型。
    
    ## 原始資料 { #raw-data }
    
    如果你需要在**不**進行 JSON 編碼的情況下傳送資料,請使用 `raw_data` 取代 `data`。
    
    這對於傳送已格式化的文字、日誌行或特殊的 <dfn title="用於表示特殊條件或狀態的值">"哨兵"</dfn> 值(例如 `[DONE]`)很有用。
    
    {* ../../docs_src/server_sent_events/tutorial003_py310.py hl[17] *}
    
    /// note
    
    `data` 與 `raw_data` 互斥。每個 `ServerSentEvent` 只能設定其中一個。
    
    ///
    
    ## 使用 `Last-Event-ID` 繼續 { #resuming-with-last-event-id }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:33:04 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  9. docs/zh/docs/tutorial/server-sent-events.md

    `data` 字段始终会被编码为 JSON。你可以传入任何可被序列化为 JSON 的值,包括 Pydantic 模型。
    
    ## 原始数据 { #raw-data }
    
    如果你需要发送**不**进行 JSON 编码的数据,请使用 `raw_data` 而不是 `data`。
    
    这对于发送预格式化文本、日志行或特殊的 <dfn title="用于指示特殊条件或状态的值">"哨兵"</dfn> 值(例如 `[DONE]`)很有用。
    
    {* ../../docs_src/server_sent_events/tutorial003_py310.py hl[17] *}
    
    /// note | 注意
    
    `data` 和 `raw_data` 是互斥的。每个 `ServerSentEvent` 上只能设置其中一个。
    
    ///
    
    ## 使用 `Last-Event-ID` 恢复 { #resuming-with-last-event-id }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:29:48 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  10. docs/ko/docs/tutorial/server-sent-events.md

    ## 원시 데이터 { #raw-data }
    
    JSON 인코딩 없이 데이터를 보내야 한다면, `data` 대신 `raw_data`를 사용하세요.
    
    미리 포맷된 텍스트, 로그 라인, 또는 `[DONE]`과 같은 특수한 <dfn title="특수한 조건이나 상태를 나타내는 데 사용되는 값">"센티널"</dfn> 값을 보낼 때 유용합니다.
    
    {* ../../docs_src/server_sent_events/tutorial003_py310.py hl[17] *}
    
    /// note | 참고
    
    `data`와 `raw_data`는 상호 배타적입니다. 각 `ServerSentEvent`에는 이 둘 중 하나만 설정할 수 있습니다.
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:56:39 GMT 2026
    - 5.3K bytes
    - Click Count (0)
Back to Top