skillfed

requests-sse

server-sent events python client library based on requests

requests-sse v0.5.3 217.6K downloads/30d#9,355 on PyPI9
Permissive license Apache-2.0 Active released

What it is and what it does

requests-sse wraps the requests library to consume Server-Sent Events from HTTP endpoints. It provides an EventSource context manager that yields individual events from an SSE stream, with built-in exception types (InvalidStatusCodeError, InvalidContentTypeError) for handling protocol violations. The package is a thin, synchronous client designed for straightforward SSE consumption in Python applications.

Typical usage involves opening an EventSource to a streaming endpoint, iterating over events in a loop, and catching requests or SSE-specific exceptions. It's built on top of requests, so it inherits that library's connection handling, timeout management, and HTTP features. The package supports Python 3.7 and later, including current and recent Python versions.

Use it for:

  • Consume real-time updates from public SSE endpoints like Wikimedia event streams or similar live data feeds
  • Build monitoring dashboards that pull continuous event streams from backend services
  • Integrate live notifications or status updates into Python applications without polling
  • Process event-driven data pipelines where events arrive asynchronously from an HTTP source

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Python client for consuming Server-Sent Events (SSE) streams over HTTP using the requests library, with built-in error handling for invalid status codes and content types.

Yes. Low install friction, active maintenance, permissive license, no known vulnerabilities, and a straightforward API make this a solid choice for SSE consumption in Python. Install it if you need to consume Server-Sent Events and prefer a synchronous, requests-based approach over async alternatives.

Install

requests-sse on PyPI

pip

pip install requests-sse

uv

uv add requests-sse

poetry

poetry add requests-sse

Installing requests-sse

Before you install

Low install friction with a single runtime dependency (requests). Active maintenance with recent commits and support across Python 3.7 through 3.14, including PyPy.

License in practice

Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install requests-sse

import requests
from requests_sse import EventSource

with EventSource("https://example.com/stream", timeout=30) as event_source:
    for event in event_source:
        print(event)

Verify before relying

  • Whether the package handles reconnection logic or requires manual retry on connection loss
  • Performance characteristics when consuming high-frequency event streams
  • Support for custom headers or authentication beyond what requests provides

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4.0,>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 1 — requests
Maintenance actively maintained — 156 days since the last release
Last repo commit
First released
Downloads 217,590/month — #9,355 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: requests_sse-0.5.3-py3-none-any.whl

Keywords: server-sent events, sse, stream, requests

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

server-sent events clientsse streaming pythonhttp event stream consumerrequests-based ssereal-time event streamingserver sent events library
streaminghttp-clientreal-time

More Python Modules packages