# streams pydantic_v2.BaseModel
  > GET https://api.example.com/events accept=text/event-stream
  one byte at a time
    1 message id='7' retry=None data=Message{'text': 'multi'} raw='{"text":\n"multi"}'
    2 note id='7' retry=1500 data=Message{'text': 'cr'} raw='{"text": "cr"}'
    3 message id=None retry=1500 data=Message{'text': '�'} raw='\n{"text": "�"}'
  < closed
    end
    response 200 progress {'reconnects': 0}
  > GET https://api.example.com/events accept=text/event-stream
  in one chunk
    1 message id='7' retry=None data=Message{'text': 'multi'} raw='{"text":\n"multi"}'
    2 note id='7' retry=1500 data=Message{'text': 'cr'} raw='{"text": "cr"}'
    3 message id=None retry=1500 data=Message{'text': '�'} raw='\n{"text": "�"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  byte order mark split
    1 message id=None retry=None data=Message{'text': 'bom'} raw='{"text": "bom"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  partial byte order mark
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  byte order mark prefix at the end
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  empty body
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  cut line at EOF
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  cut frame at EOF
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  comment before EOF
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > POST https://api.example.com/feed accept=text/event-stream
  EOF before the sentinel
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    ! StreamInterruptedError: StreamInterruptedError(operation_id='streamFeed', reason='eof', sequence=1) [operation_id='streamFeed', sequence=1] eof
  > POST https://api.example.com/feed accept=text/event-stream
  sentinel
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  after the end ! StopIteration:  []
  closed after the end ! StopIteration:  []
  > POST https://api.example.com/feed accept=text/event-stream
  sentinel at once
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  event type completion
    1 created id=None retry=None data=Created{'type': 'created', 'id': '1'} raw='{"type": "created", "id": "1"}'
    2 renamed id=None retry=None data=UnknownEvent{'discriminator': 'renamed', 'raw_data': '{"id": "2"}'} raw='{"id": "2"}'
    3 deleted id='3' retry=None data=Deleted{'type': 'deleted', 'id': '3'} raw='{"type": "deleted", "id": "3"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  before the error 1 created id=None retry=None data=Created{'type': 'created', 'id': '1'} raw='{"type": "created", "id": "1"}'
  < closed
  error event error_event {'message': 'boom'} ProtocolDataError: ProtocolDataError(operation_id='streamEvents', reason='error_event') [operation_id='streamEvents'] error_event
  after the error ! ConfigurationError: ConfigurationError(reason='invalid_state', field_path='next.failed') [field_path=('next', 'failed')] invalid_state
  > GET https://api.example.com/events accept=text/event-stream
  body discriminator
    1 message id=None retry=None data=Created{'type': 'created', 'id': '1'} raw='{"type": "created", "id": "1"}'
    2 anything id=None retry=None data=Deleted{'type': 'deleted', 'id': '2'} raw='{"type": "deleted", "id": "2"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  body error event error_event {'type': 'failed', 'message': 'nope'}
  > GET https://api.example.com/events accept=text/event-stream
  missing discriminator
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='missing', location='event.1./type') [operation_id='streamEvents', location=('event', 1, '/type'), body_bytes=b'{"id": "1"}', truncated=False] missing
  > GET https://api.example.com/events accept=text/event-stream
  null discriminator
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='null', location='event.1./type') [operation_id='streamEvents', location=('event', 1, '/type'), body_bytes=b'{"type": null}', truncated=False] null
  > GET https://api.example.com/events accept=text/event-stream
  number discriminator
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='type', location='event.1./type') [operation_id='streamEvents', location=('event', 1, '/type'), body_bytes=b'{"type": 5}', truncated=False] type
  > GET https://api.example.com/events accept=text/event-stream
  unknown discriminator
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='value', location='event.1./type') [operation_id='streamEvents', location=('event', 1, '/type'), body_bytes=b'{"type": "renamed"}', truncated=False] value
  > GET https://api.example.com/events accept=text/event-stream
  mapped event failing its type
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='value', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{"type": "created"}', truncated=False, cause=1 validation error for Created
id
  Field required [type=missing, input_value={'type': 'created'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/<version>/v/missing] value
  > GET https://api.example.com/events accept=text/event-stream
  malformed discriminator JSON
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='malformed', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{broken', truncated=False, cause=JSONDecodeError('Expecting property name enclosed in double quotes: line 1 column 2 (char 1)')] malformed
  > GET https://api.example.com/events accept=text/event-stream
  not JSON
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='malformed', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{broken', truncated=False, cause=1 validation error for Message
  Invalid JSON: key must be a string at line 1 column 2 [type=json_invalid, input_value=b'{broken', input_type=bytes]
    For further information visit https://errors.pydantic.dev/<version>/v/json_invalid] malformed
  > GET https://api.example.com/events accept=text/event-stream
  refused by its type
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='value', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{"text": 5}', truncated=False, cause=1 validation error for Message
text
  Input should be a valid string [type=string_type, input_value=5, input_type=int]
    For further information visit https://errors.pydantic.dev/<version>/v/string_type] value
  > GET https://api.example.com/events accept=text/event-stream
  refused natively
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='value', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{}', truncated=False, cause=1 validation error for Message
text
  Field required [type=missing, input_value={}, input_type=dict]
    For further information visit https://errors.pydantic.dev/<version>/v/missing] value
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  large event raw prefix 65536 truncated=True
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  invalid mapped event cause ValidationError prefix b'{"type": "created"}'
  > GET https://api.example.com/events accept=text/event-stream
  event over the native size limit
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    ! ProtocolDataError: ProtocolDataError(operation_id='streamEvents', reason='too_large') [operation_id='streamEvents', cause=SSEError('Server-sent event exceeded the 1048576 byte limit.')] too_large
  > GET https://api.example.com/events accept=text/event-stream
  comment longer than the native size limit
    1 message id=None retry=None data=Message{'text': 'after a long comment'} raw='{"text": "after a long comment"}'
  < closed
    end
  stream options of another type ! ConfigurationError: ConfigurationError(reason='invalid_value', field_path='stream_options') [field_path=('stream_options',)] invalid_value
  options of another type ! ConfigurationError: ConfigurationError(reason='invalid_value', field_path='options') [field_path=('options',)] invalid_value
  reconnecting ! ConfigurationError: ConfigurationError(reason='missing_metadata', field_path='stream_options.reconnect') [field_path=('stream_options', 'reconnect')] missing_metadata
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  declared error status ! NotFoundError: Error code: 404 - {"detail": "missing"} [operation_id='streamEvents', status_code=404, body=Problem(detail='missing'), body_bytes=b'{"detail": "missing"}', truncated=False]
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  undeclared success status ! APIStatusError: Error code: 201 [operation_id='streamEvents', status_code=201, body=b'', body_bytes=b'', truncated=False] unexpected_status
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  no media type ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='unexpected_media_type') [operation_id='streamEvents', body_bytes=b'', truncated=False] unexpected_media_type
  > GET https://api.example.com/events accept=text/event-stream
  no content
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  no content before the terminal event
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  no content before the sentinel
  < closed
    end
  > POST https://api.example.com/feed accept=text/event-stream
  < closed
  undeclared no content ! APIStatusError: Error code: 204 [operation_id='streamFeed', status_code=204, body=b'', body_bytes=b'', truncated=False] unexpected_status
  > GET https://api.example.com/events?topic=news accept=text/event-stream
  < closed
  > GET https://api.example.com/events?topic=news accept=text/event-stream
  retried 200 attempts=2
    progress {'reconnects': 0}
  retried stream
    1 message id=None retry=None data=Message{'text': 'retried'} raw='{"text": "retried"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  first 1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
  after close ! ConfigurationError: ConfigurationError(reason='invalid_state', field_path='next.closed') [field_path=('next', 'closed')] invalid_state
  close again = None
  > GET https://api.example.com/events accept=text/event-stream
    concurrent next: ConfigurationError notes []
    concurrent close: ConfigurationError notes []
  < closed
  data [{'text': 'a'}, {'text': 'a'}]
  > GET https://api.example.com/events accept=text/event-stream
  broken connection
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    ! StreamInterruptedError: StreamInterruptedError(operation_id='streamEvents', reason='transport', sequence=1) [operation_id='streamEvents', sequence=1, cause=APIConnectionError()] transport
  > GET https://api.example.com/events accept=text/event-stream
  read phase timeout
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    ! APITimeoutError: APITimeoutError(operation_id='streamEvents', reason='phase_timeout', cause='ReadTimeout') [operation_id='streamEvents', cause=ReadTimeout('read timed out')] phase_timeout
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  another media type ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='unexpected_media_type') [operation_id='streamEvents', body_bytes=b'', truncated=False, media_type='application/json'] unexpected_media_type
  > GET https://api.example.com/events accept=text/event-stream
  response end at EOF
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > POST https://api.example.com/feed accept=text/event-stream
  response end at the sentinel
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  response cut frame at EOF
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > POST https://api.example.com/feed accept=text/event-stream
  response EOF before the sentinel
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    ! StreamInterruptedError: StreamInterruptedError(operation_id='streamFeed', reason='eof', sequence=1) [operation_id='streamFeed', sequence=1] eof
  > GET https://api.example.com/events accept=text/event-stream
  response undecodable event
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='value', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{}', truncated=False, cause=1 validation error for Message
text
  Field required [type=missing, input_value={}, input_type=dict]
    For further information visit https://errors.pydantic.dev/<version>/v/missing] value
  > GET https://api.example.com/events accept=text/event-stream
  response early close after 1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
  > GET https://api.example.com/events accept=text/event-stream
  async one byte at a time
    1 message id='7' retry=None data=Message{'text': 'multi'} raw='{"text":\n"multi"}'
    2 note id='7' retry=1500 data=Message{'text': 'cr'} raw='{"text": "cr"}'
    3 message id=None retry=1500 data=Message{'text': '�'} raw='\n{"text": "�"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  async event type completion
    1 created id=None retry=None data=Created{'type': 'created', 'id': '1'} raw='{"type": "created", "id": "1"}'
    2 renamed id=None retry=None data=UnknownEvent{'discriminator': 'renamed', 'raw_data': '{"id": "2"}'} raw='{"id": "2"}'
    3 deleted id='3' retry=None data=Deleted{'type': 'deleted', 'id': '3'} raw='{"type": "deleted", "id": "3"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  async body discriminator
    1 message id=None retry=None data=Created{'type': 'created', 'id': '1'} raw='{"type": "created", "id": "1"}'
    2 anything id=None retry=None data=Deleted{'type': 'deleted', 'id': '2'} raw='{"type": "deleted", "id": "2"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  async malformed discriminator JSON
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='malformed', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{broken', truncated=False, cause=JSONDecodeError('Expecting property name enclosed in double quotes: line 1 column 2 (char 1)')] malformed
  > GET https://api.example.com/events accept=text/event-stream
  async cut frame
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  async broken connection
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    ! StreamInterruptedError: StreamInterruptedError(operation_id='streamEvents', reason='transport', sequence=1) [operation_id='streamEvents', sequence=1, cause=APIConnectionError()] transport
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  async data [{'text': 'a'}, {'text': 'a'}]
  async after the end ! StopAsyncIteration:  []
  async options of another type ! ConfigurationError: ConfigurationError(reason='invalid_value', field_path='options') [field_path=('options',)] invalid_value
  > GET https://api.example.com/events accept=text/event-stream
  async event over the native size limit
  < closed
    ! ProtocolDataError: ProtocolDataError(operation_id='streamEvents', reason='too_large') [operation_id='streamEvents', cause=SSEError('Server-sent event exceeded the 1048576 byte limit.')] too_large
  > GET https://api.example.com/events accept=text/event-stream
  async left early 1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
  > GET https://api.example.com/events accept=text/event-stream
  < closed
  async declared error status ! NotFoundError: Error code: 404 - {"detail": "missing"} [operation_id='streamEvents', status_code=404, body=Problem(detail='missing'), body_bytes=b'{"detail": "missing"}', truncated=False]
  > GET https://api.example.com/events accept=text/event-stream
  async response end at EOF
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > POST https://api.example.com/feed accept=text/event-stream
  async response end at the sentinel
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > GET https://api.example.com/events accept=text/event-stream
  async response cut frame at EOF
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    end
  > POST https://api.example.com/feed accept=text/event-stream
  async response EOF before the sentinel
    1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
    ! StreamInterruptedError: StreamInterruptedError(operation_id='streamFeed', reason='eof', sequence=1) [operation_id='streamFeed', sequence=1] eof
  > GET https://api.example.com/events accept=text/event-stream
  async response undecodable event
  < closed
    ! DecodeError: DecodeError(status_code=200, operation_id='streamEvents', reason='value', location='event.1') [operation_id='streamEvents', location=('event', 1), body_bytes=b'{}', truncated=False, cause=1 validation error for Message
text
  Field required [type=missing, input_value={}, input_type=dict]
    For further information visit https://errors.pydantic.dev/<version>/v/missing] value
  > GET https://api.example.com/events accept=text/event-stream
  async response early close after 1 message id=None retry=None data=Message{'text': 'a'} raw='{"text": "a"}'
  < closed
