File: usage.rst

package info (click to toggle)
aiohttp-sse-client2 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 264 kB
  • sloc: python: 652; makefile: 85
file content (18 lines) | stat: -rw-r--r-- 398 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
=====
Usage
=====

To use SSE Client in a project:

.. code-block:: python

    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