Server Side Events (SSE) client for Python
A Python client for SSE event sources that seamlessly integrates with urllib3 and requests.
Installation
$ pip install sseclient-py
Usage
import sseclient
def with_urllib3(url):
"""Get a streaming response for the given event feed using urllib3."""
import urllib3
http = urllib3.PoolManager()
res = http.request('GET', url, preload_content=False)
yield from sseclient.SSEClient(res).events()
def with_requests(url):
"""Get a streaming response for the given event feed using requests."""
import requests
res = requests.get(url, stream=True)
yield from sseclient.SSEClient(res).events()
def with_httpx(url):
"""Get a streaming response for the given event feed using httpx."""
import httpx
with httpx.stream('GET', url) as s:
# Note: 'yield from' is Python >= 3.3. Use for/yield instead if you
# are using an earlier version.
yield from sseclient.SSEClient(s.iter_bytes()).events()
url = 'http://domain.com/events'
for event in with_urllib3(url):
...
for event in with_requests(url):
...
for event in with_httpx(url):
...
Resources
Metadata
Release files for sseclient-py 1.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sseclient_py-1.9.0-py3-none-any.whl | Python 3 | none | any | Details for sseclient_py-1.9.0-py3-none-any.whl |
Release files / sseclient_py-1.9.0-py3-none-any.whl
| Download URL | sseclient_py-1.9.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
340062b1587fc2880892811e2ab5b176d98ef3eee98b3672ff3a3ba1e8ed0f6f
|
|
BLAKE2b-256 checksum How to use checksums |
4d2e59920f7d66b7f9932a3d83dd0ec53fab001be1e058bf582606fe414a5198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sseclient-py 1.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.