{"library":"smithy-aws-event-stream","title":"Smithy AWS Event Stream","type":"library","description":"Smithy AWS Event Stream provides components for interacting with Amazon Event Streams. It handles the serialization and deserialization of event stream messages according to the AWS Event Stream specification. This library is part of the broader `smithy-python` project, currently at version 0.2.1, with a release cadence tied to the evolution of the `smithy-python` ecosystem.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install smithy-aws-event-stream"],"cli":null},"imports":["from smithy_aws_event_stream.model import EventStreamMessage","from smithy_aws_event_stream.serde import EventStreamSerde"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://awslabs.github.io/smithy-python/","github":"https://github.com/smithy-lang/smithy-python","docs":null,"changelog":"https://github.com/smithy-lang/smithy-python/blob/develop/packages/smithy-aws-event-stream/CHANGELOG.md","pypi":"https://pypi.org/project/smithy-aws-event-stream/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"from smithy_aws_event_stream.model import EventStreamMessage, EventStreamHeader, EventStreamHeaderValue\n\n# 1. Create headers for the event stream message\nheaders = [\n    EventStreamHeader(name=\":message-type\", value=EventStreamHeaderValue.string(\"event\")),\n    EventStreamHeader(name=\":event-type\", value=EventStreamHeaderValue.string(\"MyApplicationEvent\")),\n    EventStreamHeader(name=\"correlation-id\", value=EventStreamHeaderValue.uuid(\"a1b2c3d4-e5f6-7890-1234-567890abcdef\")),\n    EventStreamHeader(name=\"is-urgent\", value=EventStreamHeaderValue.boolean(True)),\n    EventStreamHeader(name=\"sequence-number\", value=EventStreamHeaderValue.int64(1))\n]\n\n# 2. Define the payload (can be empty or any bytes)\npayload = b'{\"data\": \"This is my event payload!\"}'\n\n# 3. Create an EventStreamMessage instance\nmessage = EventStreamMessage(headers=headers, payload=payload)\n\nprint(\"Created Event Stream Message:\")\nprint(f\"  Payload: {message.payload.decode('utf-8')}\")\nprint(\"  Headers:\")\nfor header in message.headers:\n    # Using to_python() to get the native Python value from EventStreamHeaderValue\n    print(f\"    - {header.name}: {header.value.to_python()}\")\n\n# In a real-world scenario, this message would typically be serialized\n# by an EventStreamSerde instance (part of an AWS client generated by smithy-python)\n# and sent over an asynchronous stream to an AWS service.","lang":"python","description":"This quickstart demonstrates how to construct a basic `EventStreamMessage` using the library's data models. This message can then be serialized and sent over an event stream, typically within the context of an AWS client generated by `smithy-python`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}