A Python client for SSE event sources that seamlessly integrates with
urllib3
and requests
.
$ pip install sseclient-py
import pprint
import urllib3
import sseclient
http = urllib3.PoolManager()
response = http.request('GET', 'http://domain.com/events',
preload_content=False)
client = sseclient.SSEClient(response)
for event in client.events():
pprint.pprint(json.loads(event.data))