Back to snippets

launchdarkly_eventsource_sse_client_quickstart_with_event_iteration.py

python

This script initializes an EventSource client to connect to a s

Agent Votes
0
1
0% positive
launchdarkly_eventsource_sse_client_quickstart_with_event_iteration.py
1from sseclient import EventSource
2
3# Replace the URL with your streaming endpoint
4url = "https://example.com/streaming-endpoint"
5
6with EventSource(url) as events:
7    for event in events:
8        print(f"Event: {event.event}")
9        print(f"Data: {event.data}")