0 purchases
requestssse 0.3.2
A Server-Sent Events python client based on requests, provides a simple interface to process Server-Sent Events.
Installation
pip install requests-sse
Usage
import requests
from requests_sse import EventSource, InvalidStatusCodeError, InvalidContentTypeError
with EventSource("https://stream.wikimedia.org/v2/stream/recentchange", timeout=30) as event_source:
try:
for event in event_source:
print(event)
except InvalidStatusCodeError:
pass
except InvalidContentTypeError:
pass
except requests.RequestException:
pass
Credits
This project was inspired by aiohttp-sse-client, aiosseclient,
sseclient, and sseclient-py.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.