server-sent events python client library based on requests
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
requests_sse-0.3.0.tar.gz
(9.0 kB
view hashes)
Built Distribution
Close
Hashes for requests_sse-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a81550995e3b26fe2c75796a893a1fea708d43408e445b67ab35ec4ffca6bf2 |
|
MD5 | 88fe518389f1045071921d7d5bef0bd3 |
|
BLAKE2b-256 | ca4e26e49061ea0e0ea1c126050e2a969d71806d34d50dba9e9ab3cda5ef77e2 |