Skip to main content

Simple SSE Client

A lightweight SSE client that uses the httpx package based on httpx-sse.

Installation

pip install simple-sse-client

Usage

Synchronous

from simple_sse_client import stream

for event in stream("https://example.com/sse"):
    print(event)

Asynchronous

from simple_sse_client import async_stream

async for event in async_stream("https://example.com/sse"):
    print(event)

Interface

The stream and async_stream functions follow the httpx.request() interface.

stream(method, url, *, params=None, content=None, data=None, files=None, json=None, headers=None, cookies=None, auth=None, proxy=None, timeout=Timeout(timeout=5.0), follow_redirects=False, verify=True, trust_env=True)
async_stream(method, url, *, params=None, content=None, data=None, files=None, json=None, headers=None, cookies=None, auth=None, proxy=None, timeout=Timeout(timeout=5.0), follow_redirects=False, verify=True, trust_env=True)

Both functions connect to an SSE endpoint and yield ServerSentEvent objects.

Parameters:

  • method - HTTP method (GET, OPTIONS, HEAD, POST, PUT, PATCH, or DELETE).
  • url - URL.
  • params - (Optional) Query parameters to include in the URL, as a string, dictionary, or sequence of two-tuples.
  • content - (Optional) Binary content to include in the body of the request, as bytes or a byte iterator.
  • data - (Optional) Form data to include in the body of the request, as a dictionary.
  • files - (Optional) A dictionary of upload files to include in the body of the request.
  • json - (Optional) A JSON serializable object to include in the body of the request.
  • headers - (Optional) Dictionary of HTTP headers to include in the request.
  • cookies - (Optional) Dictionary of Cookie items to include in the request.
  • auth - (Optional) An authentication class to use when sending the request.
  • proxy - (Optional) A proxy URL where all the traffic should be routed.
  • timeout - (Optional) The timeout configuration to use when sending the request.
  • follow_redirects - (Optional) Enables or disables HTTP redirects.
  • verify - (Optional) Either True to use an SSL context with the default CA bundle, False to disable verification, or an instance of ssl.SSLContext to use a custom context.
  • trust_env - (Optional) Enables or disables usage of environment variables for configuration.

stream returns an Iterator[ServerSentEvent] and async_stream returns an AsyncIterator[ServerSentEvent].

Metadata

Release files for simple-sse-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-sse-client 0.1.1
File Size Uploaded Provenance Actions
simple_sse_client-0.1.1.tar.gz 7.8 kB Without provenance Details for simple_sse_client-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-sse-client 0.1.1
File Interpreter ABI Platform Actions
simple_sse_client-0.1.1-py3-none-any.whl Python 3 none any Details for simple_sse_client-0.1.1-py3-none-any.whl

Total release size: 16.1 kB

Release files / simple_sse_client-0.1.1.tar.gz

Download URL simple_sse_client-0.1.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8c4eb01ae6469fe5164352af9d574cb6b804660fef7103c675d52789a5571239
BLAKE2b-256 checksum
How to use checksums
538d345ee7ff9816b797d265f3f1b7c2c4a12c5f69e05ea4cde933d7134aaf7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / simple_sse_client-0.1.1-py3-none-any.whl

Download URL simple_sse_client-0.1.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97eb89ea221f76be6a2dd173465fc86ba5b1a8e6718a06cabe065d9c65ab9af3
BLAKE2b-256 checksum
How to use checksums
fe497c63ccac3be67469ba3e8a3bfbcdb9fad568c4ea29ae750cab165cbeb508
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Security for simple-sse-client 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page