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.1.tar.gz
(9.0 kB
view hashes)
Built Distribution
Close
Hashes for requests_sse-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd6db456bf2175dadc82f7d05efbee6178ee49247a967d935097ff16fa4228e3 |
|
MD5 | ea50ec8eafbb59635cecc4d21622a49d |
|
BLAKE2b-256 | 9eca0c842f3e9e0b41f1ee14d0c033eec23775fd2771e24914c5eb9fc3383e1d |