JelleZijlstra / aiohttp-sse-client2

Server-Sent Event python client library based on aiohttp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a fork of the aiohttp-sse-client project by Jason Hu. The motivations for the fork are:

  • Better error messages when the request fails (#190)
  • Update the library to support new Python versions

The fork will be retired if the upstream package comes back alive.

Fork changelog

  • 0.3.0 (February 7, 2023)
    • Drop support for Python 3.6
    • Support Python 3.10 and 3.11
    • Include response body in exception for non-200 response codes

Original README follows:

SSE Client

Documentation Status Updates

A Server-Sent Event python client base on aiohttp, provides a simple interface to process Server-Sent Event.

Features

  • Full asyncio support
  • Easy to integrate with other aiohttp based project
  • Auto-reconnect for network issue
  • Support python 3.6 and above

Usage

from aiohttp_sse_client2 import client as sse_client

async with sse_client.EventSource(
    'https://stream.wikimedia.org/v2/stream/recentchange'
) as event_source:
    try:
        async for event in event_source:
            print(event)
    except ConnectionError:
        pass

Credits

This project was inspired by aiosseclient, sseclient, and sseclient-py.

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

About

Server-Sent Event python client library based on aiohttp

License:Other


Languages

Language:Python 92.7%Language:Makefile 7.3%